mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-06-23 20:00:33 -04:00
Merge branch 'develop' of https://github.com/turbo124/invoiceninja into develop
This commit is contained in:
commit
de8a7c2c0d
@ -34,7 +34,6 @@ install:
|
|||||||
# these providers require referencing git commit's which cause Travis to fail
|
# these providers require referencing git commit's which cause Travis to fail
|
||||||
- sed -i '/mollie/d' composer.json
|
- sed -i '/mollie/d' composer.json
|
||||||
- sed -i '/2checkout/d' composer.json
|
- sed -i '/2checkout/d' composer.json
|
||||||
- sed -i '/omnipay-neteller/d' composer.json
|
|
||||||
- travis_retry composer install --prefer-dist;
|
- travis_retry composer install --prefer-dist;
|
||||||
|
|
||||||
before_script:
|
before_script:
|
||||||
|
@ -36,6 +36,7 @@ class AccountApiController extends BaseAPIController
|
|||||||
|
|
||||||
public function register(RegisterRequest $request)
|
public function register(RegisterRequest $request)
|
||||||
{
|
{
|
||||||
|
|
||||||
$account = $this->accountRepo->create($request->first_name, $request->last_name, $request->email, $request->password);
|
$account = $this->accountRepo->create($request->first_name, $request->last_name, $request->email, $request->password);
|
||||||
$user = $account->users()->first();
|
$user = $account->users()->first();
|
||||||
|
|
||||||
|
@ -2,7 +2,11 @@
|
|||||||
|
|
||||||
use Auth;
|
use Auth;
|
||||||
use App\Http\Requests\Request;
|
use App\Http\Requests\Request;
|
||||||
|
use Illuminate\Http\Request as InputRequest;
|
||||||
|
use Illuminate\Support\Facades\Log;
|
||||||
use Illuminate\Validation\Factory;
|
use Illuminate\Validation\Factory;
|
||||||
|
use App\Libraries\Utils;
|
||||||
|
use Response;
|
||||||
|
|
||||||
class RegisterRequest extends Request
|
class RegisterRequest extends Request
|
||||||
{
|
{
|
||||||
@ -11,6 +15,13 @@ class RegisterRequest extends Request
|
|||||||
*
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
public function __construct(InputRequest $req)
|
||||||
|
{
|
||||||
|
$this->req = $req;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public function authorize()
|
public function authorize()
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
@ -23,6 +34,7 @@ class RegisterRequest extends Request
|
|||||||
*/
|
*/
|
||||||
public function rules()
|
public function rules()
|
||||||
{
|
{
|
||||||
|
|
||||||
$rules = [
|
$rules = [
|
||||||
'email' => 'required|unique:users',
|
'email' => 'required|unique:users',
|
||||||
'first_name' => 'required',
|
'first_name' => 'required',
|
||||||
@ -32,4 +44,24 @@ class RegisterRequest extends Request
|
|||||||
|
|
||||||
return $rules;
|
return $rules;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function response(array $errors)
|
||||||
|
{
|
||||||
|
/* If the user is not validating from a mobile app - pass through parent::response */
|
||||||
|
if(!isset($this->req->api_secret))
|
||||||
|
return parent::response($errors);
|
||||||
|
|
||||||
|
/* If the user is validating from a mobile app - pass through first error string and return error */
|
||||||
|
foreach($errors as $error) {
|
||||||
|
foreach ($error as $key => $value) {
|
||||||
|
|
||||||
|
$message['error'] = ['message'=>$value];
|
||||||
|
$message = json_encode($message, JSON_PRETTY_PRINT);
|
||||||
|
$headers = Utils::getApiHeaders();
|
||||||
|
|
||||||
|
return Response::make($message, 400, $headers);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,82 +1,84 @@
|
|||||||
<?php namespace app\Listeners;
|
<?php namespace app\Listeners;
|
||||||
|
|
||||||
use Auth;
|
use Auth;
|
||||||
use Utils;
|
use Utils;
|
||||||
|
|
||||||
use App\Events\ClientWasCreated;
|
use App\Events\ClientWasCreated;
|
||||||
use App\Events\QuoteWasCreated;
|
use App\Events\QuoteWasCreated;
|
||||||
use App\Events\InvoiceWasCreated;
|
use App\Events\InvoiceWasCreated;
|
||||||
use App\Events\CreditWasCreated;
|
use App\Events\CreditWasCreated;
|
||||||
use App\Events\PaymentWasCreated;
|
use App\Events\PaymentWasCreated;
|
||||||
|
|
||||||
use App\Events\VendorWasCreated;
|
use App\Events\VendorWasCreated;
|
||||||
use App\Events\ExpenseWasCreated;
|
use App\Events\ExpenseWasCreated;
|
||||||
|
|
||||||
use App\Ninja\Transformers\InvoiceTransformer;
|
use App\Ninja\Transformers\InvoiceTransformer;
|
||||||
use App\Ninja\Transformers\ClientTransformer;
|
use App\Ninja\Transformers\ClientTransformer;
|
||||||
use App\Ninja\Transformers\PaymentTransformer;
|
use App\Ninja\Transformers\PaymentTransformer;
|
||||||
|
|
||||||
use League\Fractal\Manager;
|
use League\Fractal\Manager;
|
||||||
use League\Fractal\Resource\Item;
|
use League\Fractal\Resource\Item;
|
||||||
use App\Ninja\Serializers\ArraySerializer;
|
use App\Ninja\Serializers\ArraySerializer;
|
||||||
|
|
||||||
class SubscriptionListener
|
class SubscriptionListener
|
||||||
{
|
{
|
||||||
public function createdClient(ClientWasCreated $event)
|
public function createdClient(ClientWasCreated $event)
|
||||||
{
|
{
|
||||||
if ( ! Auth::check()) {
|
$transformer = new ClientTransformer($event->client->account);
|
||||||
return;
|
|
||||||
}
|
|
||||||
$transformer = new ClientTransformer(Auth::user()->account);
|
|
||||||
$this->checkSubscriptions(ACTIVITY_TYPE_CREATE_CLIENT, $event->client, $transformer);
|
$this->checkSubscriptions(ACTIVITY_TYPE_CREATE_CLIENT, $event->client, $transformer);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function createdQuote(QuoteWasCreated $event)
|
public function createdQuote(QuoteWasCreated $event)
|
||||||
{
|
{
|
||||||
if ( ! Auth::check()) {
|
$transformer = new InvoiceTransformer($event->quote->account);
|
||||||
return;
|
|
||||||
}
|
|
||||||
$transformer = new InvoiceTransformer(Auth::user()->account);
|
|
||||||
$this->checkSubscriptions(ACTIVITY_TYPE_CREATE_QUOTE, $event->quote, $transformer, ENTITY_CLIENT);
|
$this->checkSubscriptions(ACTIVITY_TYPE_CREATE_QUOTE, $event->quote, $transformer, ENTITY_CLIENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function createdPayment(PaymentWasCreated $event)
|
public function createdPayment(PaymentWasCreated $event)
|
||||||
{
|
{
|
||||||
if ( ! Auth::check()) {
|
$transformer = new PaymentTransformer($event->payment->account);
|
||||||
return;
|
|
||||||
}
|
|
||||||
$transformer = new PaymentTransformer(Auth::user()->account);
|
|
||||||
$this->checkSubscriptions(ACTIVITY_TYPE_CREATE_PAYMENT, $event->payment, $transformer, [ENTITY_CLIENT, ENTITY_INVOICE]);
|
$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)
|
public function createdInvoice(InvoiceWasCreated $event)
|
||||||
{
|
{
|
||||||
if ( ! Auth::check()) {
|
$transformer = new InvoiceTransformer($event->invoice->account);
|
||||||
return;
|
|
||||||
}
|
|
||||||
$transformer = new InvoiceTransformer(Auth::user()->account);
|
|
||||||
$this->checkSubscriptions(ACTIVITY_TYPE_CREATE_INVOICE, $event->invoice, $transformer, ENTITY_CLIENT);
|
$this->checkSubscriptions(ACTIVITY_TYPE_CREATE_INVOICE, $event->invoice, $transformer, ENTITY_CLIENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function createdCredit(CreditWasCreated $event)
|
||||||
|
{
|
||||||
|
//$this->checkSubscriptions(ACTIVITY_TYPE_CREATE_CREDIT, $event->credit);
|
||||||
|
}
|
||||||
|
|
||||||
public function createdVendor(VendorWasCreated $event)
|
public function createdVendor(VendorWasCreated $event)
|
||||||
{
|
{
|
||||||
//$this->checkSubscriptions(ACTIVITY_TYPE_CREATE_VENDOR, $event->vendor);
|
//$this->checkSubscriptions(ACTIVITY_TYPE_CREATE_VENDOR, $event->vendor);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function createdExpense(ExpenseWasCreated $event)
|
public function createdExpense(ExpenseWasCreated $event)
|
||||||
{
|
{
|
||||||
//$this->checkSubscriptions(ACTIVITY_TYPE_CREATE_EXPENSE, $event->expense);
|
//$this->checkSubscriptions(ACTIVITY_TYPE_CREATE_EXPENSE, $event->expense);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function checkSubscriptions($activityTypeId, $entity, $transformer, $include = '')
|
private function checkSubscriptions($activityTypeId, $entity, $transformer, $include = '')
|
||||||
{
|
{
|
||||||
$subscription = $entity->account->getSubscription($activityTypeId);
|
$subscription = $entity->account->getSubscription($activityTypeId);
|
||||||
|
|
||||||
if ($subscription) {
|
if ($subscription) {
|
||||||
$manager = new Manager();
|
$manager = new Manager();
|
||||||
$manager->setSerializer(new ArraySerializer());
|
$manager->setSerializer(new ArraySerializer());
|
||||||
$manager->parseIncludes($include);
|
$manager->parseIncludes($include);
|
||||||
|
|
||||||
$resource = new Item($entity, $transformer, $entity->getEntityType());
|
$resource = new Item($entity, $transformer, $entity->getEntityType());
|
||||||
$data = $manager->createData($resource)->toArray();
|
$data = $manager->createData($resource)->toArray();
|
||||||
|
|
||||||
// For legacy Zapier support
|
// For legacy Zapier support
|
||||||
if (isset($data['client_id'])) {
|
if (isset($data['client_id'])) {
|
||||||
$data['client_name'] = $entity->client->getDisplayName();
|
$data['client_name'] = $entity->client->getDisplayName();
|
||||||
}
|
}
|
||||||
|
|
||||||
Utils::notifyZapier($subscription, $data);
|
Utils::notifyZapier($subscription, $data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -79,7 +79,8 @@ class InvoiceService extends BaseService
|
|||||||
|
|
||||||
public function approveQuote($quote, $invitation = null)
|
public function approveQuote($quote, $invitation = null)
|
||||||
{
|
{
|
||||||
$account = Auth::user()->account;
|
$account = $quote->account;
|
||||||
|
|
||||||
if (!$quote->is_quote || $quote->quote_invoice_id) {
|
if (!$quote->is_quote || $quote->quote_invoice_id) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
use App\Models\Gateway;
|
use App\Models\Gateway;
|
||||||
use App\Models\PaymentTerm;
|
use App\Models\PaymentTerm;
|
||||||
use App\Models\Currency;
|
use App\Models\Currency;
|
||||||
@ -6,11 +7,13 @@ use App\Models\DateFormat;
|
|||||||
use App\Models\DatetimeFormat;
|
use App\Models\DatetimeFormat;
|
||||||
use App\Models\InvoiceDesign;
|
use App\Models\InvoiceDesign;
|
||||||
use App\Models\Country;
|
use App\Models\Country;
|
||||||
|
|
||||||
class PaymentLibrariesSeeder extends Seeder
|
class PaymentLibrariesSeeder extends Seeder
|
||||||
{
|
{
|
||||||
public function run()
|
public function run()
|
||||||
{
|
{
|
||||||
Eloquent::unguard();
|
Eloquent::unguard();
|
||||||
|
|
||||||
$gateways = [
|
$gateways = [
|
||||||
['name' => 'BeanStream', 'provider' => 'BeanStream', 'payment_library_id' => 2],
|
['name' => 'BeanStream', 'provider' => 'BeanStream', 'payment_library_id' => 2],
|
||||||
['name' => 'Psigate', 'provider' => 'Psigate', 'payment_library_id' => 2],
|
['name' => 'Psigate', 'provider' => 'Psigate', 'payment_library_id' => 2],
|
||||||
@ -46,6 +49,7 @@ class PaymentLibrariesSeeder extends Seeder
|
|||||||
['name' => 'WeChat Express', 'provider' => 'WeChat_Express', 'payment_library_id' => 1],
|
['name' => 'WeChat Express', 'provider' => 'WeChat_Express', 'payment_library_id' => 1],
|
||||||
['name' => 'WePay', 'provider' => 'WePay', 'payment_library_id' => 1],
|
['name' => 'WePay', 'provider' => 'WePay', 'payment_library_id' => 1],
|
||||||
];
|
];
|
||||||
|
|
||||||
foreach ($gateways as $gateway) {
|
foreach ($gateways as $gateway) {
|
||||||
$record = Gateway::where('name', '=', $gateway['name'])->first();
|
$record = Gateway::where('name', '=', $gateway['name'])->first();
|
||||||
if ($record) {
|
if ($record) {
|
||||||
@ -55,5 +59,6 @@ class PaymentLibrariesSeeder extends Seeder
|
|||||||
Gateway::create($gateway);
|
Gateway::create($gateway);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1121,7 +1121,7 @@ return array(
|
|||||||
'all_pages_header' => 'Show header on',
|
'all_pages_header' => 'Show header on',
|
||||||
'all_pages_footer' => 'Show footer on',
|
'all_pages_footer' => 'Show footer on',
|
||||||
'invoice_currency' => 'Rechnungs-Währung',
|
'invoice_currency' => 'Rechnungs-Währung',
|
||||||
'enable_https' => 'Wir empfehlen dringend HTTPS zu verwendne, um Kreditkarten online zu akzeptieren.',
|
'enable_https' => 'Wir empfehlen dringend HTTPS zu verwenden, um Kreditkarten online zu akzeptieren.',
|
||||||
'quote_issued_to' => 'Quote issued to',
|
'quote_issued_to' => 'Quote issued to',
|
||||||
'show_currency_code' => 'Währungscode',
|
'show_currency_code' => 'Währungscode',
|
||||||
'trial_message' => 'Your account will receive a free two week trial of our pro plan.',
|
'trial_message' => 'Your account will receive a free two week trial of our pro plan.',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user