Skip to content

Commit

Permalink
Fixed namespacing issue
Browse files Browse the repository at this point in the history
  • Loading branch information
ollieread committed May 6, 2020
1 parent 3bfef55 commit e929975
Show file tree
Hide file tree
Showing 15 changed files with 48 additions and 48 deletions.
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@ VatCalculator
================

[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE.md)
[![Build Status](https://travis-ci.org/sprocketbox/vat-calculator.svg)](https://travis-ci.org/sprocketbox/vat-calculator)
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/sprocketbox/vat-calculator/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/sprocketbox/vat-calculator/?branch=master)
[![Build Status](https://travis-ci.org/consilience/vat-calculator.svg)](https://travis-ci.org/consilience/vat-calculator)
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/consilience/vat-calculator/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/sprocketbox/vat-calculator/?branch=master)
[![codecov.io](https://codecov.io/github/sprocketbox/vat-calculator/coverage.svg?branch=master)](https://codecov.io/github/sprocketbox/vat-calculator?branch=master)
[![StyleCI](https://styleci.io/repos/41703624/shield)](https://styleci.io/repos/41703624)
[![SensioLabsInsight](https://insight.sensiolabs.com/projects/adecb98a-8484-48cb-be13-803decc475bc/mini.png)](https://insight.sensiolabs.com/projects/adecb98a-8484-48cb-be13-803decc475bc)

Handle all the hard stuff related to EU MOSS tax/vat regulations, the way it should be.
Can be used with **Laravel 6 / Cashier** — or **standalone**.

This is a fork of [mcpociot/vat-calculator](https://github.com/Sprocketbox/vat-calculator) updated to work with Laravel 6.
This is a fork of [mcpociot/vat-calculator](https://github.com/consilience/vat-calculator) updated to work with Laravel 6.

```php
// Easy to use!
Expand Down Expand Up @@ -64,7 +64,7 @@ All documentation examples use the Laravel 5 facade code, so make sure not to ca
Example:

```php
use Sprocketbox\VatCalculator\VatCalculator;
use Consilience\VatCalculator\VatCalculator;

$vatCalculator = new VatCalculator();
$vatCalculator->setBusinessCountryCode('DE');
Expand Down Expand Up @@ -179,7 +179,7 @@ If you want to use this package in combination with [Laravel Cashier](https://gi

```php
use Laravel\Cashier\Billable;
use Sprocketbox\VatCalculator\Concerns\BillableWithinTheEU;
use Consilience\VatCalculator\Concerns\BillableWithinTheEU;
use Laravel\Cashier\Contracts\Billable as BillableContract;

class User extends Model implements BillableContract
Expand Down Expand Up @@ -247,7 +247,7 @@ The Javascript library has no dependencies on third party frameworks.
In order to use the Javascript helper you need to publish the package files first. Go ahead and type:

```bash
$ php artisan vendor:publish --provider="Sprocketbox\VatCalculator\VatCalculatorServiceProvider"
$ php artisan vendor:publish --provider="Consilience\VatCalculator\VatCalculatorServiceProvider"
```

Now you have a file called `vat_calculator.js` in your `public/js` folder.
Expand Down Expand Up @@ -395,7 +395,7 @@ The configuration file also determines whether you want to use the VAT Calculato
To publish the configuration files, run the `vendor:publish` command

```bash
$ php artisan vendor:publish --provider="Sprocketbox\VatCalculator\VatCalculatorServiceProvider"
$ php artisan vendor:publish --provider="Consilience\VatCalculator\VatCalculatorServiceProvider"
```

This will create a `vat_calculator.php` in your config directory.
Expand Down
8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "sprocketbox/vat-calculator",
"name": "consilience/vat-calculator",
"description": "EU VAT calculation, the way it should be.",
"keywords": [
"VAT",
Expand Down Expand Up @@ -35,7 +35,7 @@
},
"autoload": {
"psr-4": {
"Sprocketbox\\VatCalculator\\": "src/"
"Consilience\\VatCalculator\\": "src/"
}
},
"minimum-stability": "stable",
Expand All @@ -45,10 +45,10 @@
"extra": {
"laravel": {
"providers": [
"Sprocketbox\\VatCalculator\\VatCalculatorServiceProvider"
"Consilience\\VatCalculator\\VatCalculatorServiceProvider"
],
"aliases": {
"VatCalculator": "Sprocketbox\\VatCalculator\\Facades\\VatCalculator"
"VatCalculator": "Consilience\\VatCalculator\\Facades\\VatCalculator"
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
</testsuites>
<filter>
<whitelist>
<directory suffix=".php">src/Sprocketbox/</directory>
<directory suffix=".php">src/Consilience/</directory>
</whitelist>
</filter>
</phpunit>
4 changes: 2 additions & 2 deletions src/Concerns/BillableWithinTheEU.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php

namespace Sprocketbox\VatCalculator\Concerns;
namespace Consilience\VatCalculator\Concerns;

use Sprocketbox\VatCalculator\Facades\VatCalculator;
use Consilience\VatCalculator\Facades\VatCalculator;

trait BillableWithinTheEU
{
Expand Down
10 changes: 5 additions & 5 deletions src/Controllers/Controller.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<?php

namespace Sprocketbox\VatCalculator\Http;
namespace Consilience\VatCalculator\Controllers;

use Illuminate\Http\Request;
use Illuminate\Routing\Controller as BaseController;
use Illuminate\Support\Facades\Response;
use Sprocketbox\VatCalculator\Exceptions\VATCheckUnavailableException;
use Sprocketbox\VatCalculator\VatCalculator;
use Consilience\VatCalculator\Exceptions\VATCheckUnavailableException;
use Consilience\VatCalculator\VatCalculator;
use Illuminate\Contracts\Config\Repository as ConfigRepository;

class Controller extends BaseController
Expand All @@ -18,7 +18,7 @@ class Controller extends BaseController

public function __construct(ConfigRepository $configRepository)
{
$this->calculator = new \Sprocketbox\VatCalculator\VatCalculator($configRepository);
$this->calculator = new VatCalculator($configRepository);
}

/**
Expand Down Expand Up @@ -82,7 +82,7 @@ public function getCountryCode()
*
* @param string $vat_id
*
* @throws \Sprocketbox\VatCalculator\Exceptions\VATCheckUnavailableException
* @throws \Consilience\VatCalculator\Exceptions\VATCheckUnavailableException
*
* @return \Illuminate\Http\Response
*/
Expand Down
2 changes: 1 addition & 1 deletion src/Exceptions/VATCheckUnavailableException.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Sprocketbox\VatCalculator\Exceptions;
namespace Consilience\VatCalculator\Exceptions;

use Exception;

Expand Down
2 changes: 1 addition & 1 deletion src/Facades/VatCalculator.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Sprocketbox\VatCalculator\Facades;
namespace Consilience\VatCalculator\Facades;

class VatCalculator extends \Illuminate\Support\Facades\Facade
{
Expand Down
6 changes: 3 additions & 3 deletions src/Validators/VatCalculatorValidatorExtension.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<?php

namespace Sprocketbox\VatCalculator\Validators;
namespace Consilience\VatCalculator\Validators;

use Illuminate\Validation\Validator;
use Sprocketbox\VatCalculator\Exceptions\VATCheckUnavailableException;
use Sprocketbox\VatCalculator\Facades\VatCalculator;
use Consilience\VatCalculator\Exceptions\VATCheckUnavailableException;
use Consilience\VatCalculator\Facades\VatCalculator;

class VatCalculatorValidatorExtension
{
Expand Down
4 changes: 2 additions & 2 deletions src/VatCalculator.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?php

namespace Sprocketbox\VatCalculator;
namespace Consilience\VatCalculator;

use Illuminate\Contracts\Config\Repository;
use Sprocketbox\VatCalculator\Exceptions\VATCheckUnavailableException;
use Consilience\VatCalculator\Exceptions\VATCheckUnavailableException;
use SoapClient;
use SoapFault;

Expand Down
6 changes: 3 additions & 3 deletions src/VatCalculatorServiceProvider.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Sprocketbox\VatCalculator;
namespace Consilience\VatCalculator;

/*
* This file is part of Teamwork
Expand Down Expand Up @@ -55,7 +55,7 @@ public function registerFacade()
{
$this->app->booting(function () {
$loader = AliasLoader::getInstance();
$loader->alias('VatCalculator', 'Sprocketbox\VatCalculator\Facades\VatCalculator');
$loader->alias('VatCalculator', 'Consilience\VatCalculator\Facades\VatCalculator');
});
}

Expand Down Expand Up @@ -112,7 +112,7 @@ protected function registerValidatorExtension()
);

$this->app['validator']->extend('vat_number',
'Sprocketbox\VatCalculator\Validators\VatCalculatorValidatorExtension@validateVatNumber');
'Consilience\VatCalculator\Validators\VatCalculatorValidatorExtension@validateVatNumber');
}

/**
Expand Down
8 changes: 4 additions & 4 deletions src/routes.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

Route::get('vatcalculator/tax-rate-for-location/{country?}/{postal_code?}', 'Sprocketbox\VatCalculator\Http\Controller@getTaxRateForLocation');
Route::get('vatcalculator/calculate', 'Sprocketbox\VatCalculator\Http\Controller@calculateGrossPrice');
Route::get('vatcalculator/country-code', 'Sprocketbox\VatCalculator\Http\Controller@getCountryCode');
Route::get('vatcalculator/validate-vat-id/{vat_id}', 'Sprocketbox\VatCalculator\Http\Controller@validateVATID');
Route::get('vatcalculator/tax-rate-for-location/{country?}/{postal_code?}', 'Consilience\VatCalculator\Controllers\Controller@getTaxRateForLocation');
Route::get('vatcalculator/calculate', 'Consilience\VatCalculator\Controllers\Controller@calculateGrossPrice');
Route::get('vatcalculator/country-code', 'Consilience\VatCalculator\Controllers\Controller@getCountryCode');
Route::get('vatcalculator/validate-vat-id/{vat_id}', 'Consilience\VatCalculator\Controllers\Controller@validateVATID');
6 changes: 3 additions & 3 deletions tests/BillableWithinTheEUTraitTest.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?php

namespace Sprocketbox\VatCalculator\Tests;
namespace Consilience\VatCalculator\Tests;

use Mockery as m;
use Sprocketbox\VatCalculator\Facades\VatCalculator;
use Consilience\VatCalculator\Facades\VatCalculator;
use PHPUnit_Framework_TestCase as PHPUnit;

class BillableWithinTheEUTraitTest extends PHPUnit
Expand Down Expand Up @@ -92,5 +92,5 @@ public function testTaxPercentGetsCalculatedByUseTaxFromAsIndividual()

class BillableWithinTheEUTraitTestStub
{
use \Sprocketbox\VatCalculator\Concerns\BillableWithinTheEU;
use \Consilience\VatCalculator\Concerns\BillableWithinTheEU;
}
10 changes: 5 additions & 5 deletions tests/VatCalculatorServiceProviderTest.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Sprocketbox\VatCalculator;
namespace Consilience\VatCalculator;

use Mockery as m;
use PHPUnit_Framework_TestCase;
Expand Down Expand Up @@ -38,7 +38,7 @@ public function testShouldBoot()
$app['validator']->shouldReceive('extend');
$app['validator']->shouldReceive('addNamespace');
$app['validator']->shouldReceive('resolver');
$sp = m::mock('Sprocketbox\VatCalculator\VatCalculatorServiceProvider[publishes,loadTranslationsFrom,registerRoutes]',
$sp = m::mock('Consilience\VatCalculator\VatCalculatorServiceProvider[publishes,loadTranslationsFrom,registerRoutes]',
[$app]
);
$sp->shouldAllowMockingProtectedMethods();
Expand Down Expand Up @@ -74,7 +74,7 @@ public function testShouldBoot()

public function testShouldRegister()
{
$sp = m::mock('Sprocketbox\VatCalculator\VatCalculatorServiceProvider[mergeConfig,registerVatCalculator,registerFacade]',
$sp = m::mock('Consilience\VatCalculator\VatCalculatorServiceProvider[mergeConfig,registerVatCalculator,registerFacade]',
['something']
);
$sp->shouldAllowMockingProtectedMethods();
Expand All @@ -88,7 +88,7 @@ public function testShouldRegister()
public function testShouldMergeConfig()
{
$test = $this;
$sp = m::mock('Sprocketbox\VatCalculator\VatCalculatorServiceProvider', ['app'])
$sp = m::mock('Consilience\VatCalculator\VatCalculatorServiceProvider', ['app'])
->shouldDeferMissing()
->shouldAllowMockingProtectedMethods();

Expand All @@ -107,7 +107,7 @@ public function testShouldRegisterFacade()
->once()
->with(m::type('callable'));

$sp = m::mock('Sprocketbox\VatCalculator\VatCalculatorServiceProvider', [$app])
$sp = m::mock('Consilience\VatCalculator\VatCalculatorServiceProvider', [$app])
->shouldDeferMissing();
$sp->registerFacade();
}
Expand Down
6 changes: 3 additions & 3 deletions tests/VatCalculatorTest.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Sprocketbox\VatCalculator;
namespace Consilience\VatCalculator;

use Mockery as m;
use PHPUnit_Framework_TestCase as PHPUnit;
Expand Down Expand Up @@ -443,7 +443,7 @@ public function testValidateVATNumberReturnsFalseOnSoapFailureWithoutForwarding(

public function testValidateVATNumberThrowsExceptionOnSoapFailure()
{
$this->setExpectedException(\Sprocketbox\VatCalculator\Exceptions\VATCheckUnavailableException::class);
$this->setExpectedException(\Consilience\VatCalculator\Exceptions\VATCheckUnavailableException::class);
$vatCheck = $this->getMockFromWsdl(__DIR__.'/checkVatService.wsdl', 'VATService');
$vatCheck->expects($this->any())
->method('checkVat')
Expand Down Expand Up @@ -471,7 +471,7 @@ public function testValidateVATNumberThrowsExceptionOnSoapFailure()

public function testCannotValidateVATNumberWhenServiceIsDown()
{
$this->setExpectedException(\Sprocketbox\VatCalculator\Exceptions\VATCheckUnavailableException::class);
$this->setExpectedException(\Consilience\VatCalculator\Exceptions\VATCheckUnavailableException::class);

$result = new \stdClass();
$result->valid = false;
Expand Down
8 changes: 4 additions & 4 deletions tests/VatCalculatorValidatorExtensionTest.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<?php

namespace Sprocketbox\VatCalculator\tests;
namespace Consilience\VatCalculator\tests;

use Illuminate\Support\Facades\Validator;
use Mockery as m;
use Sprocketbox\VatCalculator\Exceptions\VATCheckUnavailableException;
use Sprocketbox\VatCalculator\Facades\VatCalculator;
use Sprocketbox\VatCalculator\VatCalculatorServiceProvider;
use Consilience\VatCalculator\Exceptions\VATCheckUnavailableException;
use Consilience\VatCalculator\Facades\VatCalculator;
use Consilience\VatCalculator\VatCalculatorServiceProvider;
use Orchestra\Testbench\TestCase;

class VatCalculatorValidatorExtensionTest extends TestCase
Expand Down

0 comments on commit e929975

Please sign in to comment.