Skip to content

Commit

Permalink
Update Serviceable to Orchestration
Browse files Browse the repository at this point in the history
  • Loading branch information
r-kujawa committed Dec 7, 2023
1 parent 9f211b8 commit a45e660
Show file tree
Hide file tree
Showing 20 changed files with 70 additions and 65 deletions.
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@
"autoload-dev": {
"psr-4": {
"Payavel\\Checkout\\Tests\\": "tests/",
"Payavel\\Serviceable\\Tests\\Traits\\": "vendor/payavel/serviceable/tests/Traits"
"Payavel\\Orchestration\\Tests\\Traits\\": "vendor/payavel/serviceable/tests/Traits"
}
},
"scripts": {
"test": "vendor/bin/phpunit"
},
"require": {
"payavel/serviceable": "dev-master"
"payavel/orchestration": "dev-master"
},
"require-dev": {
"orchestra/testbench": "^6.0|^7.0"
Expand Down
2 changes: 1 addition & 1 deletion src/Console/Commands/Install.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Payavel\Checkout\Console\Commands;

use Payavel\Serviceable\Console\Commands\Install as Command;
use Payavel\Orchestration\Console\Commands\Install as Command;
use Illuminate\Support\Facades\Artisan;

class Install extends Command
Expand Down
2 changes: 1 addition & 1 deletion src/Console/Commands/MakeProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Payavel\Checkout\Console\Commands;

use Payavel\Serviceable\Console\Commands\MakeProvider as Command;
use Payavel\Orchestration\Console\Commands\MakeProvider as Command;
use Illuminate\Support\Facades\Artisan;

class MakeProvider extends Command
Expand Down
10 changes: 5 additions & 5 deletions src/Facades/Payment.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@

/**
* @method static \Payavel\Checkout\PaymentGateway provider($provider)
* @method static \Payavel\Serviceable\Contracts\Providable getProvider()
* @method static \Payavel\Orchestration\Contracts\Providable getProvider()
* @method static void setProvider($provider)
* @method static string|int|\Payavel\Serviceable\Contracts\Providable getDefaultProvider()
* @method static string|int|\Payavel\Orchestration\Contracts\Providable getDefaultProvider()
* @method static \Payavel\Checkout\PaymentGateway merchant($merchant)
* @method static \Payavel\Serviceable\Contracts\Merchantable getMerchant()
* @method static \Payavel\Orchestration\Contracts\Merchantable getMerchant()
* @method static void setMerchant($merchant, $strict = true)
* @method static void reset()
* @method static string|int|\Payavel\Serviceable\Contracts\Merchantable getDefaultMerchant()
* @method static string|int|\Payavel\Orchestration\Contracts\Merchantable getDefaultMerchant()
* @method static \Payavel\Checkout\PaymentResponse getWallet(\Payavel\Checkout\Models\Wallet $wallet)
* @method static \Payavel\Checkout\PaymentResponse getPaymentMethod(\Payavel\Checkout\Models\PaymentMethod $paymentMethod)
* @method static \Payavel\Checkout\PaymentResponse tokenizePaymentMethod(\Payavel\Checkout\Contracts\Billable $billable, $data)
Expand All @@ -35,7 +35,7 @@ class Payment extends Facade
*
* @return string
*/
protected static function getFacadeAccessor()
protected static function getFacadeAccessor(): string
{
return PaymentGateway::class;
}
Expand Down
4 changes: 2 additions & 2 deletions src/Models/PaymentMethod.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ protected static function newFactory()
/**
* Get the payment method's provider.
*
* @return \Payavel\Serviceable\Models\Provider
* @return \Payavel\Orchestration\Models\Provider
*/
public function getProviderAttribute()
{
Expand All @@ -61,7 +61,7 @@ public function getProviderAttribute()
/**
* Get the payment method's merchant.
*
* @return \Payavel\Serviceable\Models\Merchant
* @return \Payavel\Orchestration\Models\Merchant
*/
public function getMerchantAttribute()
{
Expand Down
4 changes: 2 additions & 2 deletions src/Models/PaymentTransaction.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
use Illuminate\Database\Eloquent\Model;
use Payavel\Checkout\Database\Factories\PaymentTransactionFactory;
use Payavel\Checkout\Models\Traits\PaymentTransactionRequests;
use Payavel\Serviceable\Models\Merchant;
use Payavel\Serviceable\Models\Provider;
use Payavel\Orchestration\Models\Merchant;
use Payavel\Orchestration\Models\Provider;

class PaymentTransaction extends Model
{
Expand Down
4 changes: 2 additions & 2 deletions src/Models/Wallet.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
use Illuminate\Database\Eloquent\Model;
use Payavel\Checkout\Database\Factories\WalletFactory;
use Payavel\Checkout\Models\Traits\WalletRequests;
use Payavel\Serviceable\Models\Merchant;
use Payavel\Serviceable\Models\Provider;
use Payavel\Orchestration\Models\Merchant;
use Payavel\Orchestration\Models\Provider;

class Wallet extends Model
{
Expand Down
7 changes: 6 additions & 1 deletion src/PaymentGateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,15 @@
use Payavel\Checkout\Models\PaymentMethod;
use Payavel\Checkout\Models\PaymentTransaction;
use Payavel\Checkout\Models\Wallet;
use Payavel\Serviceable\Service;
use Payavel\Orchestration\Service;

class PaymentGateway extends Service implements PaymentRequestor
{
public function __construct()
{
parent::__construct(Service::find('checkout'));
}

/**
* Retrieve the wallet's details from the provider.
*
Expand Down
12 changes: 6 additions & 6 deletions src/PaymentRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

use Payavel\Checkout\Contracts\PaymentRequestor;
use Payavel\Checkout\Traits\PaymentRequests;
use Payavel\Serviceable\Contracts\Merchantable;
use Payavel\Serviceable\Contracts\Providable;
use Payavel\Orchestration\Contracts\Merchantable;
use Payavel\Orchestration\Contracts\Providable;

abstract class PaymentRequest implements PaymentRequestor
{
Expand All @@ -14,20 +14,20 @@ abstract class PaymentRequest implements PaymentRequestor
/**
* The payment provider.
*
* @var \Payavel\Serviceable\Contracts\Providable
* @var \Payavel\Orchestration\Contracts\Providable
*/
protected $provider;

/**
* The payment merchant.
*
* @var \Payavel\Serviceable\Contracts\Merchantable
* @var \Payavel\Orchestration\Contracts\Merchantable
*/
protected $merchant;

/**
* @param \Payavel\Serviceable\Contracts\Providable $provider
* @param \Payavel\Serviceable\Contracts\Merchantable $merchant
* @param \Payavel\Orchestration\Contracts\Providable $provider
* @param \Payavel\Orchestration\Contracts\Merchantable $merchant
*/
public function __construct(Providable $provider, Merchantable $merchant)
{
Expand Down
16 changes: 8 additions & 8 deletions src/PaymentResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@

use Payavel\Checkout\Contracts\PaymentResponder;
use Payavel\Checkout\Traits\PaymentResponses;
use Payavel\Serviceable\Contracts\Merchantable;
use Payavel\Serviceable\Contracts\Providable;
use Payavel\Serviceable\Traits\SimulateAttributes;
use Payavel\Orchestration\Contracts\Merchantable;
use Payavel\Orchestration\Contracts\Providable;
use Payavel\Orchestration\Traits\SimulatesAttributes;
use RuntimeException;

abstract class PaymentResponse implements PaymentResponder
{
use SimulateAttributes,
use SimulatesAttributes,
PaymentResponses;

/**
Expand Down Expand Up @@ -67,14 +67,14 @@ abstract class PaymentResponse implements PaymentResponder
/**
* The provider that the $request was made towards.
*
* @var \Payavel\Serviceable\Contracts\Providable
* @var \Payavel\Orchestration\Contracts\Providable
*/
public $provider;

/**
* The merchant that was used to make the $request.
*
* @var \Payavel\Serviceable\Contracts\Merchantable
* @var \Payavel\Orchestration\Contracts\Merchantable
*/
public $merchant;

Expand Down Expand Up @@ -111,8 +111,8 @@ protected function setUp()
* Configure the response based on the request.
*
* @param string $requestMethod
* @param \Payavel\Serviceable\Contracts\Providable $provider
* @param \Payavel\Serviceable\Contracts\Merchantable $merchant
* @param \Payavel\Orchestration\Contracts\Providable $provider
* @param \Payavel\Orchestration\Contracts\Merchantable $merchant
* @return void
*/
public function configure(string $requestMethod, Providable $provider, Merchantable $merchant)
Expand Down
4 changes: 2 additions & 2 deletions src/PaymentServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
use Illuminate\Support\ServiceProvider;
use Payavel\Checkout\Console\Commands\Install;
use Payavel\Checkout\Console\Commands\MakeProvider;
use Payavel\Serviceable\Service;
use Payavel\Orchestration\Service;

class PaymentServiceProvider extends ServiceProvider
{
Expand All @@ -26,7 +26,7 @@ public function boot()
public function register()
{
$this->app->singleton(PaymentGateway::class, function ($app) {
return new PaymentGateway(Service::find('checkout'));
return new PaymentGateway;
});

$this->mergeConfigFrom(
Expand Down
2 changes: 1 addition & 1 deletion src/Traits/PaymentRequests.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
use Payavel\Checkout\Models\PaymentMethod;
use Payavel\Checkout\Models\PaymentTransaction;
use Payavel\Checkout\Models\Wallet;
use Payavel\Serviceable\Traits\ThrowsRuntimeException;
use Payavel\Orchestration\Traits\ThrowsRuntimeException;

trait PaymentRequests
{
Expand Down
2 changes: 1 addition & 1 deletion src/Traits/PaymentResponses.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
namespace Payavel\Checkout\Traits;

use Exception;
use Payavel\Serviceable\Traits\ThrowsRuntimeException;
use Payavel\Orchestration\Traits\ThrowsRuntimeException;
use RuntimeException;

trait PaymentResponses
Expand Down
4 changes: 2 additions & 2 deletions src/database/factories/PaymentTransactionFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
use Illuminate\Database\Eloquent\Factories\Factory;
use Payavel\Checkout\Models\PaymentTransaction;
use Payavel\Checkout\PaymentStatus;
use Payavel\Serviceable\Models\Merchant;
use Payavel\Serviceable\Models\Provider;
use Payavel\Orchestration\Models\Merchant;
use Payavel\Orchestration\Models\Provider;

class PaymentTransactionFactory extends Factory
{
Expand Down
4 changes: 2 additions & 2 deletions src/database/factories/WalletFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

use Illuminate\Database\Eloquent\Factories\Factory;
use Payavel\Checkout\Models\Wallet;
use Payavel\Serviceable\Models\Merchant;
use Payavel\Serviceable\Models\Provider;
use Payavel\Orchestration\Models\Merchant;
use Payavel\Orchestration\Models\Provider;

class WalletFactory extends Factory
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use Payavel\Serviceable\Traits\ServiceableConfig;
use Payavel\Orchestration\Traits\ServesConfig;

class CreateBasePaymentTables extends Migration
{
use ServiceableConfig;
use ServesConfig;

/**
* Run the migrations.
Expand Down
10 changes: 5 additions & 5 deletions tests/Feature/Console/Commands/InstallCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@

use Illuminate\Support\Str;
use Payavel\Checkout\Tests\TestCase;
use Payavel\Serviceable\Service;
use Payavel\Serviceable\Tests\Traits\AssertGatewayExists;
use Payavel\Serviceable\Tests\Traits\CreateServiceables;
use Payavel\Orchestration\Service;
use Payavel\Orchestration\Tests\Traits\AssertsGatewayExists;
use Payavel\Orchestration\Tests\Traits\CreatesServiceables;

class InstallCommandTest extends TestCase
{
use AssertGatewayExists,
CreateServiceables;
use AssertsGatewayExists,
CreatesServiceables;

/** @test */
public function install_command_defaults_to_checkout_service()
Expand Down
10 changes: 5 additions & 5 deletions tests/Feature/Console/Commands/MakeProviderCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
namespace Payavel\Checkout\Tests\Feature\Console\Commands;

use Payavel\Checkout\Tests\TestCase;
use Payavel\Serviceable\Service;
use Payavel\Serviceable\Tests\Traits\AssertGatewayExists;
use Payavel\Serviceable\Tests\Traits\CreateServiceables;
use Payavel\Orchestration\Service;
use Payavel\Orchestration\Tests\Traits\AssertsGatewayExists;
use Payavel\Orchestration\Tests\Traits\CreatesServiceables;

class MakeProviderCommandTest extends TestCase
{
use AssertGatewayExists,
CreateServiceables;
use AssertsGatewayExists,
CreatesServiceables;

/** @test */
public function make_provider_command_defaults_to_checkout_service()
Expand Down
16 changes: 8 additions & 8 deletions tests/GatewayTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
use Payavel\Checkout\PaymentRequest;
use Payavel\Checkout\PaymentResponse;
use Payavel\Checkout\PaymentStatus;
use Payavel\Serviceable\Models\Merchant;
use Payavel\Serviceable\Models\Provider;
use Payavel\Serviceable\Models\Service;
use Payavel\Orchestration\Models\Merchant;
use Payavel\Orchestration\Models\Provider;
use Payavel\Orchestration\Models\Service;

abstract class GatewayTestCase extends TestCase
{
Expand All @@ -29,16 +29,16 @@ protected function setUp(): void
{
parent::setUp();

$this->{"{$this->driver}DriverSetUp"}();
$this->{"set{$this->driver}Driver"}();
}

protected function getEnvironmentSetUp($app)
{
parent::getEnvironmentSetUp($app);

config([
'serviceable.defaults.driver' => $this->driver,
'serviceable.services.checkout' => [
'orchestration.defaults.driver' => $this->driver,
'orchestration.services.checkout' => [
'name' => 'Checkout',
'config' => 'payment',
],
Expand All @@ -50,7 +50,7 @@ protected function getEnvironmentSetUp($app)
]);
}

protected function configDriverSetUp()
protected function setConfigDriver()
{
config([
'payment.providers' => [
Expand Down Expand Up @@ -83,7 +83,7 @@ protected function configDriverSetUp()
]);
}

protected function databaseDriverSetUp()
protected function setDatabaseDriver()
{
$service = Service::create([
'id' => 'checkout',
Expand Down
Loading

0 comments on commit a45e660

Please sign in to comment.