forked from ptondereau/Laravel-UPS-Api
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
233d831
commit 914256b
Showing
22 changed files
with
124 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,7 @@ | |
/** | ||
* This is the UpsAddressValidation facade class. | ||
* | ||
* @author Pierre Tondereau <pierre@doers.fr> | ||
* @author Pierre Tondereau <pierre[email protected]> | ||
*/ | ||
class UpsAddressValidation extends Facade | ||
{ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,7 @@ | |
/** | ||
* This is the Locator facade class. | ||
* | ||
* @author Pierre Tondereau <pierre@doers.fr> | ||
* @author Pierre Tondereau <pierre[email protected]> | ||
*/ | ||
class UpsLocator extends Facade | ||
{ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,7 @@ | |
/** | ||
* This is the QuantumView facade class. | ||
* | ||
* @author Pierre Tondereau <pierre@doers.fr> | ||
* @author Pierre Tondereau <pierre[email protected]> | ||
*/ | ||
class UpsQuantumView extends Facade | ||
{ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,7 @@ | |
/** | ||
* This is the Rate facade class. | ||
* | ||
* @author Pierre Tondereau <pierre@doers.fr> | ||
* @author Pierre Tondereau <pierre[email protected]> | ||
*/ | ||
class UpsRate extends Facade | ||
{ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,9 +5,9 @@ | |
use Illuminate\Support\Facades\Facade; | ||
|
||
/** | ||
* This is the Tradeability facade class. | ||
* This is the Shipping facade class. | ||
* | ||
* @author Pierre Tondereau <pierre@doers.fr> | ||
* @author Pierre Tondereau <pierre[email protected]> | ||
*/ | ||
class UpsShipping extends Facade | ||
{ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?php | ||
|
||
namespace Ptondereau\LaravelUpsApi\Facades; | ||
|
||
use Illuminate\Support\Facades\Facade; | ||
|
||
/** | ||
* This is the UpsSimpleAddressValidation facade class. | ||
* | ||
* @author Pierre Tondereau <[email protected]> | ||
*/ | ||
class UpsSimpleAddressValidation extends Facade | ||
{ | ||
/** | ||
* Get the registered name of the component. | ||
* | ||
* @return string | ||
*/ | ||
protected static function getFacadeAccessor() | ||
{ | ||
return 'ups.simple-address-validation'; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,9 +5,9 @@ | |
use Illuminate\Support\Facades\Facade; | ||
|
||
/** | ||
* This is the Tracking facade class. | ||
* This is the TimeInTransit facade class. | ||
* | ||
* @author Pierre Tondereau <pierre@doers.fr> | ||
* @author Pierre Tondereau <pierre[email protected]> | ||
*/ | ||
class UpsTimeInTransit extends Facade | ||
{ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,7 @@ | |
/** | ||
* This is the Tracking facade class. | ||
* | ||
* @author Pierre Tondereau <pierre@doers.fr> | ||
* @author Pierre Tondereau <pierre[email protected]> | ||
*/ | ||
class UpsTracking extends Facade | ||
{ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,7 @@ | |
/** | ||
* This is the Tradeability facade class. | ||
* | ||
* @author Pierre Tondereau <pierre@doers.fr> | ||
* @author Pierre Tondereau <pierre[email protected]> | ||
*/ | ||
class UpsTradeability extends Facade | ||
{ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,14 +11,15 @@ | |
use Ups\QuantumView; | ||
use Ups\Rate; | ||
use Ups\Shipping; | ||
use Ups\SimpleAddressValidation; | ||
use Ups\TimeInTransit; | ||
use Ups\Tracking; | ||
use Ups\Tradeability; | ||
|
||
/** | ||
* This is the Ups Api service provider class. | ||
* | ||
* @author Pierre Tondereau <pierre@doers.fr> | ||
* @author Pierre Tondereau <pierre[email protected]> | ||
*/ | ||
class UpsApiServiceProvider extends ServiceProvider | ||
{ | ||
|
@@ -40,6 +41,7 @@ public function boot() | |
public function register() | ||
{ | ||
$this->registerAddressValidation(); | ||
$this->registerSimpleAddressValidation(); | ||
$this->registerQuantumView(); | ||
$this->registerTracking(); | ||
$this->registerRate(); | ||
|
@@ -86,6 +88,27 @@ protected function registerAddressValidation() | |
}); | ||
} | ||
|
||
/** | ||
* Register the SimpleAddressValidation class. | ||
* | ||
* @return void | ||
*/ | ||
protected function registerSimpleAddressValidation() | ||
{ | ||
$this->app->singleton('ups.simple-address-validation', function (Container $app) { | ||
$config = $app->config->get('ups'); | ||
|
||
return new SimpleAddressValidation( | ||
$config['access_key'], | ||
$config['user_id'], | ||
$config['password'], | ||
$config['sandbox'], | ||
null, | ||
$app->make('log') | ||
); | ||
}); | ||
} | ||
|
||
/** | ||
* Register the QuantumView class. | ||
* | ||
|
@@ -242,6 +265,7 @@ public function provides() | |
{ | ||
return [ | ||
'ups.address-validation', | ||
'ups.simple-address-validation', | ||
'ups.quantum-view', | ||
'ups.tracking', | ||
'ups.rate', | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,7 @@ | |
/** | ||
* This is the config test class. | ||
* | ||
* @author Pierre Tondereau <pierre@doers.fr> | ||
* @author Pierre Tondereau <pierre[email protected]> | ||
*/ | ||
class ConfigTest extends TestCase | ||
{ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,7 +10,7 @@ | |
/** | ||
* This is the UpsAddressValidationTest facade test class. | ||
* | ||
* @author Pierre Tondereau <pierre@doers.fr> | ||
* @author Pierre Tondereau <pierre[email protected]> | ||
*/ | ||
class UpsAddressValidationTest extends TestCase | ||
{ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,7 +10,7 @@ | |
/** | ||
* This is the UpsLocatorTest facade test class. | ||
* | ||
* @author Pierre Tondereau <pierre@doers.fr> | ||
* @author Pierre Tondereau <pierre[email protected]> | ||
*/ | ||
class UpsLocatorTest extends TestCase | ||
{ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,7 +10,7 @@ | |
/** | ||
* This is the UpsQuantumViewTest facade test class. | ||
* | ||
* @author Pierre Tondereau <pierre@doers.fr> | ||
* @author Pierre Tondereau <pierre[email protected]> | ||
*/ | ||
class UpsQuantumViewTest extends TestCase | ||
{ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,7 +10,7 @@ | |
/** | ||
* This is the UpsRateTest facade test class. | ||
* | ||
* @author Pierre Tondereau <pierre@doers.fr> | ||
* @author Pierre Tondereau <pierre[email protected]> | ||
*/ | ||
class UpsRateTest extends TestCase | ||
{ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,9 +8,9 @@ | |
use Ups\Shipping; | ||
|
||
/** | ||
* This is the UpsTradeabilityTest facade test class. | ||
* This is the UpsShippingTest facade test class. | ||
* | ||
* @author Pierre Tondereau <pierre@doers.fr> | ||
* @author Pierre Tondereau <pierre[email protected]> | ||
*/ | ||
class UpsShippingTest extends TestCase | ||
{ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<?php | ||
|
||
namespace Ptondereau\Tests\LaravelUpsApi\Facades; | ||
|
||
use GrahamCampbell\TestBenchCore\FacadeTrait; | ||
use Ptondereau\LaravelUpsApi\Facades\UpsSimpleAddressValidation; | ||
use Ptondereau\Tests\LaravelUpsApi\TestCase; | ||
use Ups\SimpleAddressValidation; | ||
|
||
/** | ||
* This is the UpsSimpleAddressValidationTest facade test class. | ||
* | ||
* @author Pierre Tondereau <[email protected]> | ||
*/ | ||
class UpsSimpleAddressValidationTest extends TestCase | ||
{ | ||
use FacadeTrait; | ||
|
||
/** | ||
* Get the facade accessor. | ||
* | ||
* @return string | ||
*/ | ||
protected function getFacadeAccessor() | ||
{ | ||
return 'ups.simple-address-validation'; | ||
} | ||
|
||
/** | ||
* Get the facade class. | ||
* | ||
* @return string | ||
*/ | ||
protected function getFacadeClass() | ||
{ | ||
return UpsSimpleAddressValidation::class; | ||
} | ||
|
||
/** | ||
* Get the facade root. | ||
* | ||
* @return string | ||
*/ | ||
protected function getFacadeRoot() | ||
{ | ||
return SimpleAddressValidation::class; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,7 +10,7 @@ | |
/** | ||
* This is the UpsTimeInTransitTest facade test class. | ||
* | ||
* @author Pierre Tondereau <pierre@doers.fr> | ||
* @author Pierre Tondereau <pierre[email protected]> | ||
*/ | ||
class UpsTimeInTransitTest extends TestCase | ||
{ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,7 +10,7 @@ | |
/** | ||
* This is the UpsTrackingTest facade test class. | ||
* | ||
* @author Pierre Tondereau <pierre@doers.fr> | ||
* @author Pierre Tondereau <pierre[email protected]> | ||
*/ | ||
class UpsTrackingTest extends TestCase | ||
{ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,7 +10,7 @@ | |
/** | ||
* This is the UpsTradeabilityTest facade test class. | ||
* | ||
* @author Pierre Tondereau <pierre@doers.fr> | ||
* @author Pierre Tondereau <pierre[email protected]> | ||
*/ | ||
class UpsTradeabilityTest extends TestCase | ||
{ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,14 +8,15 @@ | |
use Ups\QuantumView; | ||
use Ups\Rate; | ||
use Ups\Shipping; | ||
use Ups\SimpleAddressValidation; | ||
use Ups\TimeInTransit; | ||
use Ups\Tracking; | ||
use Ups\Tradeability; | ||
|
||
/** | ||
* This is the service provider test class. | ||
* | ||
* @author Pierre Tondereau <pierre@doers.fr> | ||
* @author Pierre Tondereau <pierre[email protected]> | ||
*/ | ||
class ServiceProviderTest extends TestCase | ||
{ | ||
|
@@ -26,6 +27,11 @@ public function testAddressValidationIsInjectable() | |
$this->assertIsInjectable(AddressValidation::class); | ||
} | ||
|
||
public function testSimpleAddressValidationIsInjectable() | ||
{ | ||
$this->assertIsInjectable(SimpleAddressValidation::class); | ||
} | ||
|
||
public function testQuantumViewIsInjectable() | ||
{ | ||
$this->assertIsInjectable(QuantumView::class); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,7 @@ | |
/** | ||
* This is the abstract test case class. | ||
* | ||
* @author Pierre Tondereau <pierre@doers.fr> | ||
* @author Pierre Tondereau <pierre[email protected]> | ||
*/ | ||
abstract class TestCase extends AbstractPackageTestCase | ||
{ | ||
|