mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-10 05:02:36 +01:00
Stub GMail Driver (#3099)
* fix for blank client settings * Force all custom fields to strings * Fixes for bulk actions * Fixes for company POST route.. * Change text from Bitcoin to CRYPTO * Implement default_gateway_type_id in transformer * use scopes for company filtering * Implement validation for portal_domain * Add Google API client * Add activities to company transformer
This commit is contained in:
parent
34cf93b78e
commit
4bc92a7aa1
@ -22,7 +22,7 @@ define('BANK_LIBRARY_OFX', 1);
|
|||||||
define('GATEWAY_TYPE_CREDIT_CARD', 1);
|
define('GATEWAY_TYPE_CREDIT_CARD', 1);
|
||||||
define('GATEWAY_TYPE_BANK_TRANSFER', 2);
|
define('GATEWAY_TYPE_BANK_TRANSFER', 2);
|
||||||
define('GATEWAY_TYPE_PAYPAL', 3);
|
define('GATEWAY_TYPE_PAYPAL', 3);
|
||||||
define('GATEWAY_TYPE_BITCOIN', 4);
|
define('GATEWAY_TYPE_CRYPTO', 4);
|
||||||
define('GATEWAY_TYPE_DWOLLA', 5);
|
define('GATEWAY_TYPE_DWOLLA', 5);
|
||||||
define('GATEWAY_TYPE_CUSTOM1', 6);
|
define('GATEWAY_TYPE_CUSTOM1', 6);
|
||||||
define('GATEWAY_TYPE_ALIPAY', 7);
|
define('GATEWAY_TYPE_ALIPAY', 7);
|
||||||
|
@ -188,7 +188,8 @@ class ClientFilters extends QueryFilters
|
|||||||
public function entityFilter()
|
public function entityFilter()
|
||||||
{
|
{
|
||||||
|
|
||||||
return $this->builder->whereCompanyId(auth()->user()->company()->id);
|
//return $this->builder->whereCompanyId(auth()->user()->company()->id);
|
||||||
|
return $this->builder->company();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -168,7 +168,9 @@ class InvoiceFilters extends QueryFilters
|
|||||||
if(auth('contact')->user())
|
if(auth('contact')->user())
|
||||||
return $this->contactViewFilter();
|
return $this->contactViewFilter();
|
||||||
else
|
else
|
||||||
return $this->builder->whereCompanyId(auth()->user()->company()->id);
|
return $this->builder->company();
|
||||||
|
|
||||||
|
// return $this->builder->whereCompanyId(auth()->user()->company()->id);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -119,7 +119,7 @@ class PaymentFilters extends QueryFilters
|
|||||||
if(auth('contact')->user())
|
if(auth('contact')->user())
|
||||||
return $this->contactViewFilter();
|
return $this->contactViewFilter();
|
||||||
else
|
else
|
||||||
return $this->builder->whereCompanyId(auth()->user()->company()->id);
|
return $this->builder->company();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -115,7 +115,7 @@ class ProductFilters extends QueryFilters
|
|||||||
public function entityFilter()
|
public function entityFilter()
|
||||||
{
|
{
|
||||||
|
|
||||||
return $this->builder->whereCompanyId(auth()->user()->company()->id);
|
return $this->builder->company();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -113,7 +113,7 @@ class QuoteFilters extends QueryFilters
|
|||||||
public function entityFilter()
|
public function entityFilter()
|
||||||
{
|
{
|
||||||
|
|
||||||
return $this->builder->whereCompanyId(auth()->user()->company()->id);
|
return $this->builder->company();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -113,7 +113,7 @@ class RecurringInvoiceFilters extends QueryFilters
|
|||||||
public function entityFilter()
|
public function entityFilter()
|
||||||
{
|
{
|
||||||
|
|
||||||
return $this->builder->whereCompanyId(auth()->user()->company()->id);
|
return $this->builder->company();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -113,7 +113,7 @@ class RecurringQuoteFilters extends QueryFilters
|
|||||||
public function entityFilter()
|
public function entityFilter()
|
||||||
{
|
{
|
||||||
|
|
||||||
return $this->builder->whereCompanyId(auth()->user()->company()->id);
|
return $this->builder->company();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
76
app/Helpers/Mail/GmailTransportConfig.php
Normal file
76
app/Helpers/Mail/GmailTransportConfig.php
Normal file
@ -0,0 +1,76 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Invoice Ninja (https://invoiceninja.com)
|
||||||
|
*
|
||||||
|
* @link https://github.com/invoiceninja/invoiceninja source repository
|
||||||
|
*
|
||||||
|
* @copyright Copyright (c) 2019. Invoice Ninja LLC (https://invoiceninja.com)
|
||||||
|
*
|
||||||
|
* @license https://opensource.org/licenses/AAL
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace App\Helpers\Mail;
|
||||||
|
|
||||||
|
use App\Models\User;
|
||||||
|
use Illuminate\Support\Facades\Mail;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GmailTransportConfig
|
||||||
|
*/
|
||||||
|
class GmailTransportConfig
|
||||||
|
{
|
||||||
|
|
||||||
|
public function __invoke(User $user)
|
||||||
|
{
|
||||||
|
|
||||||
|
// $transport = (new Swift_SmtpTransport('smtp.googlemail.com', 465, 'ssl'))
|
||||||
|
// ->setUsername('YOUR_GMAIL_USERNAME')
|
||||||
|
// ->setPassword('YOUR_GMAIL_PASSWORD')
|
||||||
|
// ;
|
||||||
|
//
|
||||||
|
// $transport = \Swift_SmtpTransport::newInstance($host, $port);
|
||||||
|
// set encryption
|
||||||
|
if (isset($encryption)) $transport->setEncryption($encryption);
|
||||||
|
// set username and password
|
||||||
|
if (isset($username))
|
||||||
|
{
|
||||||
|
$transport->setUsername($username);
|
||||||
|
$transport->setPassword($password);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// // Create the Transport
|
||||||
|
|
||||||
|
|
||||||
|
// // Create the Mailer using your created Transport
|
||||||
|
// $mailer = new Swift_Mailer($transport);
|
||||||
|
|
||||||
|
/********************* We may need to fetch a new token on behalf of the client ******************************/
|
||||||
|
|
||||||
|
$transport = (new Swift_SmtpTransport('smtp.gmail.com', 587, 'tls'))
|
||||||
|
->setAuthMode('XOAUTH2')
|
||||||
|
->setUsername('turbo124@gmail.com')
|
||||||
|
->setPassword('');
|
||||||
|
|
||||||
|
// set new swift mailer
|
||||||
|
Mail::setSwiftMailer(new \Swift_Mailer($transport));
|
||||||
|
|
||||||
|
|
||||||
|
Mail::to('david@romulus.com.au')
|
||||||
|
->send('test');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -65,10 +65,11 @@ class ActivityController extends BaseController
|
|||||||
public function index()
|
public function index()
|
||||||
{
|
{
|
||||||
|
|
||||||
$activities = Activity::whereCompanyId(auth()->user()->company()->id)
|
$activities = Activity::orderBy('created_at', 'DESC')->company()
|
||||||
->orderBy('created_at', 'DESC')
|
|
||||||
->take(50);
|
->take(50);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return $this->listResponse($activities);
|
return $this->listResponse($activities);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -249,7 +249,7 @@ class LoginController extends BaseController
|
|||||||
if(request()->has('code'))
|
if(request()->has('code'))
|
||||||
return $this->handleProviderCallback($provider);
|
return $this->handleProviderCallback($provider);
|
||||||
else
|
else
|
||||||
return Socialite::driver($provider)->scopes()->redirect();
|
return Socialite::driver($provider)->scopes('gmail.send')->redirect();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -261,7 +261,7 @@ class LoginController extends BaseController
|
|||||||
if(request()->has('code'))
|
if(request()->has('code'))
|
||||||
return $this->handleProviderCallbackAndCreate($provider);
|
return $this->handleProviderCallbackAndCreate($provider);
|
||||||
else
|
else
|
||||||
return Socialite::driver($provider)->redirectUrl($redirect_url)->redirect();
|
return Socialite::driver($provider)->scopes('gmail.send')->redirectUrl($redirect_url)->redirect();
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -207,6 +207,8 @@ class CompanyController extends BaseController
|
|||||||
|
|
||||||
$company = CreateCompany::dispatchNow($request->all(), auth()->user()->company()->account);
|
$company = CreateCompany::dispatchNow($request->all(), auth()->user()->company()->account);
|
||||||
|
|
||||||
|
$company = $this->company_repo->save($request->all(), $company);
|
||||||
|
|
||||||
$company->saveSettings($request->input('settings'), $company);
|
$company->saveSettings($request->input('settings'), $company);
|
||||||
|
|
||||||
$this->uploadLogo($request->file('company_logo'), $company, $company);
|
$this->uploadLogo($request->file('company_logo'), $company, $company);
|
||||||
|
@ -519,7 +519,7 @@ class InvoiceController extends BaseController
|
|||||||
|
|
||||||
$ids = request()->input('ids');
|
$ids = request()->input('ids');
|
||||||
|
|
||||||
$invoices = Invoice::withTrashed()->find($this->transformKeys($ids))->whereCompanyId(auth()->user()->companyId());
|
$invoices = Invoice::withTrashed()->find($this->transformKeys($ids))->company();
|
||||||
|
|
||||||
if(!$invoices)
|
if(!$invoices)
|
||||||
return response()->json(['message'=>'No Invoices Found']);
|
return response()->json(['message'=>'No Invoices Found']);
|
||||||
|
@ -130,9 +130,14 @@ class TemplateController extends BaseController
|
|||||||
*/
|
*/
|
||||||
public function show($entity, $entity_id)
|
public function show($entity, $entity_id)
|
||||||
{
|
{
|
||||||
$text = request()->input('text');
|
|
||||||
|
$class = 'App\Models\\'.ucfirst($entity);
|
||||||
|
|
||||||
return response()->json($text, 200);
|
$entity_obj = $class::find($entity_id)->company();
|
||||||
|
|
||||||
|
$markdown = request()->input('text');
|
||||||
|
|
||||||
|
return response()->json($markdown, 200);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33,11 +33,17 @@ class StoreCompanyRequest extends Request
|
|||||||
{
|
{
|
||||||
//$this->sanitize();
|
//$this->sanitize();
|
||||||
$rules = [];
|
$rules = [];
|
||||||
|
$input = $this->all();
|
||||||
|
|
||||||
//$rules['name'] = 'required';
|
//$rules['name'] = 'required';
|
||||||
$rules['company_logo'] = 'mimes:jpeg,jpg,png,gif|max:10000'; // max 10000kb
|
$rules['company_logo'] = 'mimes:jpeg,jpg,png,gif|max:10000'; // max 10000kb
|
||||||
$rules['settings'] = new ValidSettingsRule();
|
$rules['settings'] = new ValidSettingsRule();
|
||||||
$rules['portal_domain'] = 'url';
|
|
||||||
|
if(isset($rules['portal_mode']) && ($rules['portal_mode'] == 'domain' || $rules['portal_mode'] == 'iframe'))
|
||||||
|
$rules['portal_domain'] = 'sometimes|url';
|
||||||
|
else
|
||||||
|
$rules['portal_domain'] = 'nullable|alpha_num';
|
||||||
|
|
||||||
return $rules;
|
return $rules;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,8 +43,11 @@ class UpdateCompanyRequest extends Request
|
|||||||
$rules['size_id'] = 'integer|nullable';
|
$rules['size_id'] = 'integer|nullable';
|
||||||
$rules['country_id'] = 'integer|nullable';
|
$rules['country_id'] = 'integer|nullable';
|
||||||
$rules['work_email'] = 'email|nullable';
|
$rules['work_email'] = 'email|nullable';
|
||||||
$rules['portal_domain'] = 'url';
|
|
||||||
|
|
||||||
|
if(isset($rules['portal_mode']) && ($rules['portal_mode'] == 'domain' || $rules['portal_mode'] == 'iframe'))
|
||||||
|
$rules['portal_domain'] = 'sometimes|url';
|
||||||
|
else
|
||||||
|
$rules['portal_domain'] = 'nullable|alpha_num';
|
||||||
|
|
||||||
return $rules;
|
return $rules;
|
||||||
|
|
||||||
|
@ -67,9 +67,9 @@ class BaseModel extends Model
|
|||||||
/*
|
/*
|
||||||
V2 type of scope
|
V2 type of scope
|
||||||
*/
|
*/
|
||||||
public function scopeCompany($query, $company_id)
|
public function scopeCompany($query)
|
||||||
{
|
{
|
||||||
$query->where('company_id', $company_id);
|
$query->where('company_id', auth()->user()->companyId());
|
||||||
|
|
||||||
return $query;
|
return $query;
|
||||||
}
|
}
|
||||||
|
@ -101,9 +101,7 @@ class Company extends BaseModel
|
|||||||
|
|
||||||
public function users()
|
public function users()
|
||||||
{
|
{
|
||||||
|
|
||||||
return $this->hasManyThrough(User::class, CompanyUser::class, 'company_id', 'id', 'id', 'user_id');
|
return $this->hasManyThrough(User::class, CompanyUser::class, 'company_id', 'id', 'id', 'user_id');
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -114,6 +112,11 @@ class Company extends BaseModel
|
|||||||
return $this->hasMany(Client::class)->withTrashed();
|
return $this->hasMany(Client::class)->withTrashed();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function activities()
|
||||||
|
{
|
||||||
|
return $this->hasMany(Activity::class);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return \Illuminate\Database\Eloquent\Relations\HasMany
|
* @return \Illuminate\Database\Eloquent\Relations\HasMany
|
||||||
*/
|
*/
|
||||||
|
@ -37,7 +37,7 @@ class Payment extends BaseModel
|
|||||||
const TYPE_CREDIT_CARD = 1;
|
const TYPE_CREDIT_CARD = 1;
|
||||||
const TYPE_BANK_TRANSFER = 2;
|
const TYPE_BANK_TRANSFER = 2;
|
||||||
const TYPE_PAYPAL = 3;
|
const TYPE_PAYPAL = 3;
|
||||||
const TYPE_BITCOIN = 4;
|
const TYPE_CRYPTO = 4;
|
||||||
const TYPE_DWOLLA = 5;
|
const TYPE_DWOLLA = 5;
|
||||||
const TYPE_CUSTOM1 = 6;
|
const TYPE_CUSTOM1 = 6;
|
||||||
const TYPE_ALIPAY = 7;
|
const TYPE_ALIPAY = 7;
|
||||||
|
@ -42,7 +42,7 @@ class PaymentType extends StaticModel
|
|||||||
const SOFORT = 29;
|
const SOFORT = 29;
|
||||||
const SEPA = 30;
|
const SEPA = 30;
|
||||||
const GOCARDLESS = 31;
|
const GOCARDLESS = 31;
|
||||||
const BITCOIN = 32;
|
const CRYPTO = 32;
|
||||||
|
|
||||||
public static function parseCardType($cardName)
|
public static function parseCardType($cardName)
|
||||||
{
|
{
|
||||||
|
@ -51,6 +51,7 @@ class RecurringInvoice extends BaseModel
|
|||||||
const FREQUENCY_SIX_MONTHS = 9;
|
const FREQUENCY_SIX_MONTHS = 9;
|
||||||
const FREQUENCY_ANNUALLY = 10;
|
const FREQUENCY_ANNUALLY = 10;
|
||||||
const FREQUENCY_TWO_YEARS = 11;
|
const FREQUENCY_TWO_YEARS = 11;
|
||||||
|
const FREQUENCY_THREE_YEARS = 12;
|
||||||
|
|
||||||
const RECURS_INDEFINITELY = -1;
|
const RECURS_INDEFINITELY = -1;
|
||||||
|
|
||||||
@ -164,6 +165,8 @@ class RecurringInvoice extends BaseModel
|
|||||||
return Carbon::parse($this->next_send_date->addYear());
|
return Carbon::parse($this->next_send_date->addYear());
|
||||||
case RecurringInvoice::FREQUENCY_TWO_YEARS:
|
case RecurringInvoice::FREQUENCY_TWO_YEARS:
|
||||||
return Carbon::parse($this->next_send_date->addYears(2));
|
return Carbon::parse($this->next_send_date->addYears(2));
|
||||||
|
case RecurringInvoice::FREQUENCY_THREE_YEARS:
|
||||||
|
return Carbon::parse($this->next_send_date->addYears(3));
|
||||||
default:
|
default:
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -29,4 +29,14 @@ class StaticModel extends Model
|
|||||||
return (string)$this->attributes['id'];
|
return (string)$this->attributes['id'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
V2 type of scope
|
||||||
|
*/
|
||||||
|
public function scopeCompany($query)
|
||||||
|
{
|
||||||
|
$query->where('company_id', auth()->user()->companyId());
|
||||||
|
|
||||||
|
return $query;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -82,7 +82,7 @@ class StripePaymentDriver extends BasePaymentDriver
|
|||||||
$types[] = GatewayType::SEPA;
|
$types[] = GatewayType::SEPA;
|
||||||
|
|
||||||
if ($this->company_gateway->getBitcoinEnabled())
|
if ($this->company_gateway->getBitcoinEnabled())
|
||||||
$types[] = GatewayType::BITCOIN;
|
$types[] = GatewayType::CRYPTO;
|
||||||
|
|
||||||
if ($this->company_gateway->getAlipayEnabled())
|
if ($this->company_gateway->getAlipayEnabled())
|
||||||
$types[] = GatewayType::ALIPAY;
|
$types[] = GatewayType::ALIPAY;
|
||||||
@ -113,7 +113,7 @@ class StripePaymentDriver extends BasePaymentDriver
|
|||||||
case GatewayType::SEPA:
|
case GatewayType::SEPA:
|
||||||
return 'portal.default.gateways.stripe.sepa';
|
return 'portal.default.gateways.stripe.sepa';
|
||||||
break;
|
break;
|
||||||
case GatewayType::BITCOIN:
|
case GatewayType::CRYPTO:
|
||||||
return 'portal.default.gateways.stripe.other';
|
return 'portal.default.gateways.stripe.other';
|
||||||
break;
|
break;
|
||||||
case GatewayType::ALIPAY:
|
case GatewayType::ALIPAY:
|
||||||
|
@ -43,7 +43,7 @@ class UserPolicy extends EntityPolicy
|
|||||||
*/
|
*/
|
||||||
public function edit(User $user, $user_entity) : bool
|
public function edit(User $user, $user_entity) : bool
|
||||||
{
|
{
|
||||||
$company_user = CompanyUser::whereUserId($user_entity->id)->whereCompanyId($user->companyId())->first();
|
$company_user = CompanyUser::whereUserId($user_entity->id)->company()->first();
|
||||||
|
|
||||||
return ($user->isAdmin() && $company_user);
|
return ($user->isAdmin() && $company_user);
|
||||||
|
|
||||||
|
@ -48,7 +48,7 @@ class CompanyRepository extends BaseRepository
|
|||||||
public function save(array $data, Company $company) : ?Company
|
public function save(array $data, Company $company) : ?Company
|
||||||
{
|
{
|
||||||
|
|
||||||
if(isset($data['custom_fields']))
|
if(isset($data['custom_fields']) && is_array($data['custom_fields']))
|
||||||
$data['custom_fields'] = $this->parseCustomFields($data['custom_fields']);
|
$data['custom_fields'] = $this->parseCustomFields($data['custom_fields']);
|
||||||
|
|
||||||
$company->fill($data);
|
$company->fill($data);
|
||||||
|
@ -13,6 +13,7 @@ namespace App\Transformers;
|
|||||||
|
|
||||||
|
|
||||||
use App\Models\Account;
|
use App\Models\Account;
|
||||||
|
use App\Models\Activity;
|
||||||
use App\Models\Client;
|
use App\Models\Client;
|
||||||
use App\Models\Company;
|
use App\Models\Company;
|
||||||
use App\Models\CompanyGateway;
|
use App\Models\CompanyGateway;
|
||||||
@ -20,6 +21,7 @@ use App\Models\CompanyUser;
|
|||||||
use App\Models\GroupSetting;
|
use App\Models\GroupSetting;
|
||||||
use App\Models\TaxRate;
|
use App\Models\TaxRate;
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
|
use App\Transformers\ActivityTransformer;
|
||||||
use App\Transformers\CompanyGatewayTransformer;
|
use App\Transformers\CompanyGatewayTransformer;
|
||||||
use App\Transformers\CompanyUserTransformer;
|
use App\Transformers\CompanyUserTransformer;
|
||||||
use App\Transformers\GroupSettingTransformer;
|
use App\Transformers\GroupSettingTransformer;
|
||||||
@ -58,6 +60,7 @@ class CompanyTransformer extends EntityTransformer
|
|||||||
'company_user',
|
'company_user',
|
||||||
'groups',
|
'groups',
|
||||||
'company_gateways',
|
'company_gateways',
|
||||||
|
'activities'
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
@ -107,6 +110,13 @@ class CompanyTransformer extends EntityTransformer
|
|||||||
return $this->includeItem($company->company_users->where('user_id', auth()->user()->id)->first(), $transformer, CompanyUser::class);
|
return $this->includeItem($company->company_users->where('user_id', auth()->user()->id)->first(), $transformer, CompanyUser::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function includeActivities(Company $company)
|
||||||
|
{
|
||||||
|
$transformer = new ActivityTransformer($this->serializer);
|
||||||
|
|
||||||
|
return $this->includeCollection($company->activities, $transformer, Activity::class);
|
||||||
|
}
|
||||||
|
|
||||||
public function includeUsers(Company $company)
|
public function includeUsers(Company $company)
|
||||||
{
|
{
|
||||||
$transformer = new UserTransformer($this->serializer);
|
$transformer = new UserTransformer($this->serializer);
|
||||||
|
@ -45,7 +45,7 @@ class GatewayTransformer extends EntityTransformer
|
|||||||
'provider' => (string)$gateway->provider ?: '',
|
'provider' => (string)$gateway->provider ?: '',
|
||||||
'visible' => (bool)$gateway->visible,
|
'visible' => (bool)$gateway->visible,
|
||||||
'sort_order' => (int)$gateway->sort_order,
|
'sort_order' => (int)$gateway->sort_order,
|
||||||
//'recommended' => (bool)$gateway->recommended,
|
'default_gateway_type_id' => (bool)$gateway->default_gateway_type_id,
|
||||||
'site_url' => (string)$gateway->site_url ?: '',
|
'site_url' => (string)$gateway->site_url ?: '',
|
||||||
'is_offsite' => (bool)$gateway->is_offsite,
|
'is_offsite' => (bool)$gateway->is_offsite,
|
||||||
'is_secure' => (bool)$gateway->is_secure,
|
'is_secure' => (bool)$gateway->is_secure,
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
"asgrim/ofxparser": "^1.2",
|
"asgrim/ofxparser": "^1.2",
|
||||||
"davejamesmiller/laravel-breadcrumbs": "5.x",
|
"davejamesmiller/laravel-breadcrumbs": "5.x",
|
||||||
"fideloper/proxy": "^4.0",
|
"fideloper/proxy": "^4.0",
|
||||||
|
"google/apiclient": "^2.0",
|
||||||
"hashids/hashids": "^3.0",
|
"hashids/hashids": "^3.0",
|
||||||
"intervention/image": "^2.4",
|
"intervention/image": "^2.4",
|
||||||
"laracasts/presenter": "^0.2.1",
|
"laracasts/presenter": "^0.2.1",
|
||||||
|
@ -13,7 +13,7 @@ class GatewayTypesSeeder extends Seeder
|
|||||||
['alias' => 'credit_card', 'name' => 'Credit Card'],
|
['alias' => 'credit_card', 'name' => 'Credit Card'],
|
||||||
['alias' => 'bank_transfer', 'name' => 'Bank Transfer'],
|
['alias' => 'bank_transfer', 'name' => 'Bank Transfer'],
|
||||||
['alias' => 'paypal', 'name' => 'PayPal'],
|
['alias' => 'paypal', 'name' => 'PayPal'],
|
||||||
['alias' => 'bitcoin', 'name' => 'Bitcoin'],
|
['alias' => 'crypto', 'name' => 'Crypto'],
|
||||||
['alias' => 'dwolla', 'name' => 'Dwolla'],
|
['alias' => 'dwolla', 'name' => 'Dwolla'],
|
||||||
['alias' => 'custom1', 'name' => 'Custom'],
|
['alias' => 'custom1', 'name' => 'Custom'],
|
||||||
['alias' => 'alipay', 'name' => 'Alipay'],
|
['alias' => 'alipay', 'name' => 'Alipay'],
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
use App\Models\Gateway;
|
use App\Models\Gateway;
|
||||||
|
use App\Models\GatewayType;
|
||||||
use Illuminate\Database\Seeder;
|
use Illuminate\Database\Seeder;
|
||||||
|
|
||||||
class PaymentLibrariesSeeder extends Seeder
|
class PaymentLibrariesSeeder extends Seeder
|
||||||
@ -24,10 +25,10 @@ class PaymentLibrariesSeeder extends Seeder
|
|||||||
['name' => 'NetBanx', 'provider' => 'NetBanx', 'key' => '334d419939c06bd99b4dfd8a49243f0f', 'fields' => '{"accountNumber":"","storeId":"","storePassword":"","testMode":false}'],
|
['name' => 'NetBanx', 'provider' => 'NetBanx', 'key' => '334d419939c06bd99b4dfd8a49243f0f', 'fields' => '{"accountNumber":"","storeId":"","storePassword":"","testMode":false}'],
|
||||||
['name' => 'PayFast', 'provider' => 'PayFast', 'is_offsite' => true, 'key' => 'd6814fc83f45d2935e7777071e629ef9', 'fields' => '{"merchantId":"","merchantKey":"","pdtKey":"","passphrase":"","testMode":false}'],
|
['name' => 'PayFast', 'provider' => 'PayFast', 'is_offsite' => true, 'key' => 'd6814fc83f45d2935e7777071e629ef9', 'fields' => '{"merchantId":"","merchantKey":"","pdtKey":"","passphrase":"","testMode":false}'],
|
||||||
['name' => 'Payflow Pro', 'provider' => 'Payflow_Pro', 'key' => '0d97c97d227f91c5d0cb86d01e4a52c9', 'fields' => '{"username":"","password":"","vendor":"","partner":"","testMode":false}'],
|
['name' => 'Payflow Pro', 'provider' => 'Payflow_Pro', 'key' => '0d97c97d227f91c5d0cb86d01e4a52c9', 'fields' => '{"username":"","password":"","vendor":"","partner":"","testMode":false}'],
|
||||||
['name' => 'PaymentExpress PxPay', 'provider' => 'PaymentExpress_PxPay', 'key' => 'a66b7062f4c8212d2c428209a34aa6bf', 'fields' => '{"username":"","password":"","pxPostUsername":"","pxPostPassword":"","testMode":false}'],
|
['name' => 'PaymentExpress PxPay', 'provider' => 'PaymentExpress_PxPay', 'key' => 'a66b7062f4c8212d2c428209a34aa6bf', 'fields' => '{"username":"","password":"","pxPostUsername":"","pxPostPassword":"","testMode":false}','default_gateway_type_id' => GatewayType::PAYPAL],
|
||||||
['name' => 'PaymentExpress PxPost', 'provider' => 'PaymentExpress_PxPost', 'key' => '7e6fc08b89467518a5953a4839f8baba', 'fields' => '{"username":"","password":"","testMode":false}'],
|
['name' => 'PaymentExpress PxPost', 'provider' => 'PaymentExpress_PxPost', 'key' => '7e6fc08b89467518a5953a4839f8baba', 'fields' => '{"username":"","password":"","testMode":false}','default_gateway_type_id' => GatewayType::PAYPAL],
|
||||||
['name' => 'PayPal Express', 'provider' => 'PayPal_Express', 'is_offsite' => true, 'sort_order' => 4, 'key' => '38f2c48af60c7dd69e04248cbb24c36e', 'fields' => '{"username":"","password":"","signature":"","testMode":false,"solutionType":["Sole","Mark"],"landingPage":["Billing","Login"],"brandName":"","headerImageUrl":"","logoImageUrl":"","borderColor":""}'],
|
['name' => 'PayPal Express', 'provider' => 'PayPal_Express', 'is_offsite' => true, 'sort_order' => 4, 'key' => '38f2c48af60c7dd69e04248cbb24c36e', 'fields' => '{"username":"","password":"","signature":"","testMode":false,"solutionType":["Sole","Mark"],"landingPage":["Billing","Login"],"brandName":"","headerImageUrl":"","logoImageUrl":"","borderColor":""}','default_gateway_type_id' => GatewayType::PAYPAL],
|
||||||
['name' => 'PayPal Pro', 'provider' => 'PayPal_Pro', 'key' => '80af24a6a69f5c0bbec33e930ab40665', 'fields' => '{"username":"","password":"","signature":"","testMode":false}'],
|
['name' => 'PayPal Pro', 'provider' => 'PayPal_Pro', 'key' => '80af24a6a69f5c0bbec33e930ab40665', 'fields' => '{"username":"","password":"","signature":"","testMode":false}','default_gateway_type_id' => GatewayType::PAYPAL],
|
||||||
['name' => 'Pin', 'provider' => 'Pin', 'key' => '0749cb92a6b36c88bd9ff8aabd2efcab', 'fields' => '{"secretKey":"","testMode":false}'],
|
['name' => 'Pin', 'provider' => 'Pin', 'key' => '0749cb92a6b36c88bd9ff8aabd2efcab', 'fields' => '{"secretKey":"","testMode":false}'],
|
||||||
['name' => 'SagePay Direct', 'provider' => 'SagePay_Direct', 'key' => '4c8f4e5d0f353a122045eb9a60cc0f2d', 'fields' => '{"vendor":"","testMode":false,"referrerId":""}'],
|
['name' => 'SagePay Direct', 'provider' => 'SagePay_Direct', 'key' => '4c8f4e5d0f353a122045eb9a60cc0f2d', 'fields' => '{"vendor":"","testMode":false,"referrerId":""}'],
|
||||||
['name' => 'SecurePay DirectPost', 'provider' => 'SecurePay_DirectPost', 'key' => '8036a5aadb2bdaafb23502da8790b6a2', 'fields' => '{"merchantId":"","transactionPassword":"","testMode":false,"enable_ach":"","enable_sofort":"","enable_apple_pay":"","enable_alipay":""}'],
|
['name' => 'SecurePay DirectPost', 'provider' => 'SecurePay_DirectPost', 'key' => '8036a5aadb2bdaafb23502da8790b6a2', 'fields' => '{"merchantId":"","transactionPassword":"","testMode":false,"enable_ach":"","enable_sofort":"","enable_apple_pay":"","enable_alipay":""}'],
|
||||||
|
@ -41,7 +41,7 @@ class PaymentTypesSeeder extends Seeder
|
|||||||
['name' => 'Sofort', 'gateway_type_id' => GATEWAY_TYPE_SOFORT],
|
['name' => 'Sofort', 'gateway_type_id' => GATEWAY_TYPE_SOFORT],
|
||||||
['name' => 'SEPA', 'gateway_type_id' => GATEWAY_TYPE_SEPA],
|
['name' => 'SEPA', 'gateway_type_id' => GATEWAY_TYPE_SEPA],
|
||||||
['name' => 'GoCardless', 'gateway_type_id' => GATEWAY_TYPE_GOCARDLESS],
|
['name' => 'GoCardless', 'gateway_type_id' => GATEWAY_TYPE_GOCARDLESS],
|
||||||
['name' => 'Bitcoin', 'gateway_type_id' => GATEWAY_TYPE_BITCOIN],
|
['name' => 'Crypto', 'gateway_type_id' => GATEWAY_TYPE_CRYPTO],
|
||||||
];
|
];
|
||||||
|
|
||||||
foreach ($paymentTypes as $paymentType) {
|
foreach ($paymentTypes as $paymentType) {
|
||||||
|
@ -18,6 +18,7 @@ use Illuminate\Http\Request;
|
|||||||
use Illuminate\Http\UploadedFile;
|
use Illuminate\Http\UploadedFile;
|
||||||
use Illuminate\Support\Facades\Log;
|
use Illuminate\Support\Facades\Log;
|
||||||
use Illuminate\Support\Facades\Session;
|
use Illuminate\Support\Facades\Session;
|
||||||
|
use Illuminate\Validation\ValidationException;
|
||||||
use Tests\TestCase;
|
use Tests\TestCase;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -40,6 +41,8 @@ class CompanyTest extends TestCase
|
|||||||
|
|
||||||
Model::reguard();
|
Model::reguard();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testCompanyList()
|
public function testCompanyList()
|
||||||
@ -124,13 +127,22 @@ class CompanyTest extends TestCase
|
|||||||
$settings->quote_design_id = 1;
|
$settings->quote_design_id = 1;
|
||||||
|
|
||||||
$company->settings = $settings;
|
$company->settings = $settings;
|
||||||
|
// $this->withoutExceptionHandling();
|
||||||
|
|
||||||
|
// try{
|
||||||
$response = $this->withHeaders([
|
$response = $this->withHeaders([
|
||||||
'X-API-SECRET' => config('ninja.api_secret'),
|
'X-API-SECRET' => config('ninja.api_secret'),
|
||||||
'X-API-TOKEN' => $token,
|
'X-API-TOKEN' => $token,
|
||||||
])->put('/api/v1/companies/'.$this->encodePrimaryKey($company->id), $company->toArray())
|
])->put('/api/v1/companies/'.$this->encodePrimaryKey($company->id), $company->toArray())
|
||||||
->assertStatus(200)->decodeResponseJson();
|
->assertStatus(200)->decodeResponseJson();
|
||||||
|
// }
|
||||||
|
// catch(ValidationException $e) {
|
||||||
|
// // \Log::error('in the validator');
|
||||||
|
// $message = json_decode($e->validator->getMessageBag(),1);
|
||||||
|
// \Log::error($message);
|
||||||
|
// $this->assertNotNull($message);
|
||||||
|
|
||||||
|
// }
|
||||||
|
|
||||||
$response = $this->withHeaders([
|
$response = $this->withHeaders([
|
||||||
'X-API-SECRET' => config('ninja.api_secret'),
|
'X-API-SECRET' => config('ninja.api_secret'),
|
||||||
|
Loading…
Reference in New Issue
Block a user