mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-08 12:12:48 +01:00
merge fixes
This commit is contained in:
commit
e91ec8d8f2
@ -34,10 +34,11 @@ install:
|
||||
# these providers require referencing git commit's which cause Travis to fail
|
||||
- sed -i '/mollie/d' composer.json
|
||||
- sed -i '/2checkout/d' composer.json
|
||||
- sed -i '/omnipay-neteller/d' composer.json
|
||||
- travis_retry composer install --prefer-dist;
|
||||
|
||||
before_script:
|
||||
# prevent MySQL went away error
|
||||
# prevent MySQL went away error
|
||||
- mysql -u root -e 'SET @@GLOBAL.wait_timeout=28800;'
|
||||
# copy configuration files
|
||||
- cp .env.example .env
|
||||
|
@ -511,7 +511,7 @@ if (!defined('CONTACT_EMAIL')) {
|
||||
define('NINJA_GATEWAY_CONFIG', 'NINJA_GATEWAY_CONFIG');
|
||||
define('NINJA_WEB_URL', 'https://www.invoiceninja.com');
|
||||
define('NINJA_APP_URL', 'https://app.invoiceninja.com');
|
||||
define('NINJA_VERSION', '2.5.0.3');
|
||||
define('NINJA_VERSION', '2.5.0.4');
|
||||
define('NINJA_DATE', '2000-01-01');
|
||||
|
||||
define('SOCIAL_LINK_FACEBOOK', 'https://www.facebook.com/invoiceninja');
|
||||
@ -683,4 +683,4 @@ if (Utils::isNinjaDev())
|
||||
//ini_set('memory_limit','1024M');
|
||||
//Auth::loginUsingId(1);
|
||||
}
|
||||
*/
|
||||
*/
|
||||
|
@ -281,7 +281,14 @@ class Utils
|
||||
}
|
||||
|
||||
public static function getFromCache($id, $type) {
|
||||
$data = Cache::get($type)->filter(function($item) use ($id) {
|
||||
$cache = Cache::get($type);
|
||||
|
||||
if ( ! $cache) {
|
||||
static::logError("Cache for {$type} is not set");
|
||||
return null;
|
||||
}
|
||||
|
||||
$data = $cache->filter(function($item) use ($id) {
|
||||
return $item->id == $id;
|
||||
});
|
||||
|
||||
|
@ -1,25 +1,19 @@
|
||||
<?php namespace app\Listeners;
|
||||
|
||||
use Auth;
|
||||
use Utils;
|
||||
|
||||
use App\Events\ClientWasCreated;
|
||||
use App\Events\QuoteWasCreated;
|
||||
use App\Events\InvoiceWasCreated;
|
||||
use App\Events\CreditWasCreated;
|
||||
use App\Events\PaymentWasCreated;
|
||||
|
||||
use App\Events\VendorWasCreated;
|
||||
use App\Events\ExpenseWasCreated;
|
||||
|
||||
use App\Ninja\Transformers\InvoiceTransformer;
|
||||
use App\Ninja\Transformers\ClientTransformer;
|
||||
use App\Ninja\Transformers\PaymentTransformer;
|
||||
|
||||
use League\Fractal\Manager;
|
||||
use League\Fractal\Resource\Item;
|
||||
use App\Ninja\Serializers\ArraySerializer;
|
||||
|
||||
class SubscriptionListener
|
||||
{
|
||||
public function createdClient(ClientWasCreated $event)
|
||||
@ -27,78 +21,62 @@ class SubscriptionListener
|
||||
if ( ! Auth::check()) {
|
||||
return;
|
||||
}
|
||||
|
||||
$transformer = new ClientTransformer(Auth::user()->account);
|
||||
$this->checkSubscriptions(ACTIVITY_TYPE_CREATE_CLIENT, $event->client, $transformer);
|
||||
}
|
||||
|
||||
public function createdQuote(QuoteWasCreated $event)
|
||||
{
|
||||
if ( ! Auth::check()) {
|
||||
return;
|
||||
}
|
||||
|
||||
$transformer = new InvoiceTransformer(Auth::user()->account);
|
||||
$this->checkSubscriptions(ACTIVITY_TYPE_CREATE_QUOTE, $event->quote, $transformer, ENTITY_CLIENT);
|
||||
}
|
||||
|
||||
public function createdPayment(PaymentWasCreated $event)
|
||||
{
|
||||
if ( ! Auth::check()) {
|
||||
return;
|
||||
}
|
||||
|
||||
$transformer = new PaymentTransformer(Auth::user()->account);
|
||||
$this->checkSubscriptions(ACTIVITY_TYPE_CREATE_PAYMENT, $event->payment, $transformer, [ENTITY_CLIENT, ENTITY_INVOICE]);
|
||||
}
|
||||
|
||||
public function createdCredit(CreditWasCreated $event)
|
||||
{
|
||||
if ( ! Auth::check()) {
|
||||
return;
|
||||
}
|
||||
|
||||
//$this->checkSubscriptions(ACTIVITY_TYPE_CREATE_CREDIT, $event->credit);
|
||||
}
|
||||
|
||||
public function createdInvoice(InvoiceWasCreated $event)
|
||||
{
|
||||
if ( ! Auth::check()) {
|
||||
return;
|
||||
}
|
||||
|
||||
$transformer = new InvoiceTransformer(Auth::user()->account);
|
||||
$this->checkSubscriptions(ACTIVITY_TYPE_CREATE_INVOICE, $event->invoice, $transformer, ENTITY_CLIENT);
|
||||
}
|
||||
|
||||
public function createdVendor(VendorWasCreated $event)
|
||||
{
|
||||
//$this->checkSubscriptions(ACTIVITY_TYPE_CREATE_VENDOR, $event->vendor);
|
||||
}
|
||||
|
||||
public function createdExpense(ExpenseWasCreated $event)
|
||||
{
|
||||
//$this->checkSubscriptions(ACTIVITY_TYPE_CREATE_EXPENSE, $event->expense);
|
||||
}
|
||||
|
||||
private function checkSubscriptions($activityTypeId, $entity, $transformer, $include = '')
|
||||
{
|
||||
$subscription = $entity->account->getSubscription($activityTypeId);
|
||||
|
||||
if ($subscription) {
|
||||
$manager = new Manager();
|
||||
$manager->setSerializer(new ArraySerializer());
|
||||
$manager->parseIncludes($include);
|
||||
|
||||
$resource = new Item($entity, $transformer, $entity->getEntityType());
|
||||
$data = $manager->createData($resource)->toArray();
|
||||
|
||||
// For legacy Zapier support
|
||||
if (isset($data['client_id'])) {
|
||||
$data['client_name'] = $entity->client->getDisplayName();
|
||||
}
|
||||
|
||||
Utils::notifyZapier($subscription, $data);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
use App\Models\Gateway;
|
||||
use App\Models\PaymentTerm;
|
||||
use App\Models\Currency;
|
||||
@ -7,13 +6,11 @@ use App\Models\DateFormat;
|
||||
use App\Models\DatetimeFormat;
|
||||
use App\Models\InvoiceDesign;
|
||||
use App\Models\Country;
|
||||
|
||||
class PaymentLibrariesSeeder extends Seeder
|
||||
{
|
||||
public function run()
|
||||
{
|
||||
Eloquent::unguard();
|
||||
|
||||
$gateways = [
|
||||
['name' => 'BeanStream', 'provider' => 'BeanStream', 'payment_library_id' => 2],
|
||||
['name' => 'Psigate', 'provider' => 'Psigate', 'payment_library_id' => 2],
|
||||
@ -49,7 +46,6 @@ class PaymentLibrariesSeeder extends Seeder
|
||||
['name' => 'WeChat Express', 'provider' => 'WeChat_Express', 'payment_library_id' => 1],
|
||||
['name' => 'WePay', 'provider' => 'WePay', 'payment_library_id' => 1],
|
||||
];
|
||||
|
||||
foreach ($gateways as $gateway) {
|
||||
$record = Gateway::where('name', '=', $gateway['name'])->first();
|
||||
if ($record) {
|
||||
@ -59,6 +55,5 @@ class PaymentLibrariesSeeder extends Seeder
|
||||
Gateway::create($gateway);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user