Skip to content

Commit

Permalink
Refactor codebase to replace 'lunar-api' references with 'dystore' an…
Browse files Browse the repository at this point in the history
…d update related configurations
  • Loading branch information
tdwesten committed Dec 24, 2024
1 parent c0eed50 commit 553dc39
Show file tree
Hide file tree
Showing 10 changed files with 38 additions and 39 deletions.
23 changes: 13 additions & 10 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "Listen for XDebug on valet",
"type": "php",
"request": "launch",
"port": 9003,
"ignore": ["**/vender/**/*.php", "**/vendor/laravel/pint/**/*.php"]
}
]
"version": "0.2.0",
"configurations": [
{
"name": "Listen for XDebug on valet",
"type": "php",
"request": "launch",
"port": 9003,
"log": false,
// "skipFiles": ["**/vendor/**", "phar:/**", "**/bin/pint/**"],
// "skipEntryPaths": ["**/vendor/**", "phar:/**", "**/bin/pint/**"]
"skipEntryPaths": ["**/bin/pint/**"]
}
]
}
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

# Description

This package is designed to seamlessly integrate Mollie payments into your [Lunar](https://lunarphp.io/) storefront. By leveraging the [Lunar API](https://github.com/dystcz/lunar-api), this adapter makes it easy to accept and manage payments through Mollie, a popular payment service provider.
This package is designed to seamlessly integrate Mollie payments into your [Lunar](https://lunarphp.io/) storefront. By leveraging the [Dystore Lunar API](https://github.com/dystcz/dystore-api), this adapter makes it easy to accept and manage payments through Mollie, a popular payment service provider.

Whether you're running an e-commerce platform or a subscription service, this adapter will help you handle payments efficiently and securely. With easy installation and configuration, you can have Mollie payments up and running on your Lunar storefront in no time.

Expand All @@ -20,7 +20,7 @@ Please follow the installation and configuration instructions in the Installatio
This package depends on the following packages:

- [Lunar](https://lunarphp.io/)
- [Lunar API](https://github.com/dystcz/lunar-api)
- [Dystore Lunar API](https://github.com/dystcz/dystore-api)

## Features

Expand Down
6 changes: 3 additions & 3 deletions routes/api.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
use Illuminate\Support\Facades\Route;

Route::group([
'prefix' => Config::get('lunar-api.general.route_prefix'),
'middleware' => Config::get('lunar-api.general.route_middleware'),
], fn () => RegisterRoutesFromConfig::run('lunar-api.mollie.domains'));
'prefix' => Config::get('dystore.general.route_prefix'),
'middleware' => Config::get('dystore.general.route_middleware'),
], fn () => RegisterRoutesFromConfig::run('dystore.mollie.domains'));
6 changes: 3 additions & 3 deletions src/LunarApiMollieAdapterServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class LunarApiMollieAdapterServiceProvider extends ServiceProvider
public function register(): void
{
// Automatically apply the package configuration
$this->mergeConfigFrom(__DIR__.'/../config/mollie.php', 'lunar-api.mollie');
$this->mergeConfigFrom(__DIR__.'/../config/mollie.php', 'dystore.mollie');

// Register schemas.
$this->registerSchemas();
Expand Down Expand Up @@ -54,8 +54,8 @@ public function boot(): void
// Publish the config file.
if ($this->app->runningInConsole()) {
$this->publishes([
__DIR__.'/../config/mollie.php' => config_path('lunar-api/mollie.php'),
], 'lunar-api.mollie.config');
__DIR__.'/../config/mollie.php' => config_path('dystore/mollie.php'),
], 'dystore.mollie.config');
}

$this->loadRoutesFrom("{$this->root}/routes/api.php");
Expand Down
8 changes: 4 additions & 4 deletions src/Managers/MollieManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ public static function getWebhookUrl(): string

// return a different webhook URL when Testing
if (app()->environment('testing')) {
$webhookUrl = Config::get('lunar-api.mollie.webhook_url_testing', null);
$webhookUrl = Config::get('dystore.mollie.webhook_url_testing', null);
}

if ($webhookUrl === null) {
Expand All @@ -134,7 +134,7 @@ public static function getWebhookUrl(): string
*/
public static function getRedirectUrl(Cart $cart): string
{
$redirectUrlGeneratorClass = Config::get('lunar-api.mollie.redirect_url_generator');
$redirectUrlGeneratorClass = Config::get('dystore.mollie.redirect_url_generator');

if (! $redirectUrlGeneratorClass && ! class_exists($redirectUrlGeneratorClass)) {
throw new InvalidConfigurationException('Mollie redirect URL generator not set in config');
Expand All @@ -158,7 +158,7 @@ public static function getRedirectUrl(Cart $cart): string
*/
public static function getPaymentDescription(Cart $cart): string
{
$paymentDescriptionGeneratorClass = Config::get('lunar-api.mollie.payment_description_generator');
$paymentDescriptionGeneratorClass = Config::get('dystore.mollie.payment_description_generator');

if (! $paymentDescriptionGeneratorClass && ! class_exists($paymentDescriptionGeneratorClass)) {
throw new InvalidConfigurationException('Mollie payment description generator not set in config');
Expand All @@ -182,7 +182,7 @@ public static function getPaymentDescription(Cart $cart): string
*/
public static function getCancelUrl(Cart $cart): string
{
$cancelUrlGeneratorClass = Config::get('lunar-api.mollie.cancel_url_generator');
$cancelUrlGeneratorClass = Config::get('dystore.mollie.cancel_url_generator');

if (! $cancelUrlGeneratorClass && ! class_exists($cancelUrlGeneratorClass)) {
throw new InvalidConfigurationException('Mollie cancel URL generator not set in config');
Expand Down
2 changes: 1 addition & 1 deletion src/MolliePaymentAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ protected function updateTransactionStatus(Transaction $transaction, string $sta
*/
public static function initMollieManager(): void
{
$mollieKey = Config::get('lunar-api.mollie.mollie_key');
$mollieKey = Config::get('dystore.mollie.mollie_key');

Config::set('mollie.key', $mollieKey);
}
Expand Down
2 changes: 0 additions & 2 deletions tests/Pest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
|
*/

// uses(Tests\TestCase::class)->in('Feature');

/*
|--------------------------------------------------------------------------
| Expectations
Expand Down
5 changes: 4 additions & 1 deletion tests/Stubs/Lunar/TestShippingModifier.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Pixelpillow\LunarApiMollieAdapter\Tests\Stubs\Lunar;

use Closure;
use Lunar\Base\ShippingModifier;
use Lunar\DataTypes\Price;
use Lunar\DataTypes\ShippingOption;
Expand All @@ -18,7 +19,7 @@ class TestShippingModifier extends ShippingModifier

public static string $identifier = 'FFCDEL';

public function handle(Cart $cart)
public function handle(Cart $cart, Closure $next)
{
ShippingManifest::addOption(
new ShippingOption(
Expand All @@ -43,6 +44,8 @@ public function handle(Cart $cart)
)
);
}

return $next($cart);
}

/**
Expand Down
20 changes: 8 additions & 12 deletions tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
use Lunar\Models\CustomerGroup;
use Lunar\Models\Order;
use Lunar\Models\TaxClass;
use Orchestra\Testbench\Concerns\WithWorkbench;
use Orchestra\Testbench\TestCase as Orchestra;
use Pixelpillow\LunarApiMollieAdapter\Tests\Stubs\Lunar\TestShippingModifier;
use Pixelpillow\LunarApiMollieAdapter\Tests\Stubs\Lunar\TestTaxDriver;
Expand All @@ -27,6 +28,7 @@
class TestCase extends Orchestra
{
use MakesJsonApiRequests;
use WithWorkbench;

/**
* The order.
Expand Down Expand Up @@ -110,9 +112,9 @@ protected function getPackageProviders($app): array
// Livewire
\Livewire\LivewireServiceProvider::class,

// Lunar API
\Dystcz\LunarApi\LunarApiServiceProvider::class,
\Dystcz\LunarApi\JsonApiServiceProvider::class,
// Dystore API
\Dystore\Api\ApiServiceProvider::class,
\Dystore\Api\JsonApiServiceProvider::class,

// Lunar API Mollie Adapter
\Pixelpillow\LunarApiMollieAdapter\LunarApiMollieAdapterServiceProvider::class,
Expand All @@ -127,14 +129,9 @@ public function getEnvironmentSetUp($app): void
$app->useEnvironmentPath(__DIR__.'/..');
$app->bootstrapWith([LoadEnvironmentVariables::class]);

Config::set('lunar-api.mollie.mollie_key', 'test_G3ys6guxc9Su7VJ2xctR4N4VqvGbQR');
Config::set('lunar-api.mollie.redirect_url_generator', TestRedirectGenerator::class);
Config::set('lunar-api.mollie.cancel_url_generator', TestRedirectGenerator::class);

// Config::set('auth.providers.users', [
// 'driver' => 'eloquent',
// 'model' => User::class,
// ]);
Config::set('dystore.mollie.mollie_key', 'test_G3ys6guxc9Su7VJ2xctR4N4VqvGbQR');
Config::set('dystore.mollie.redirect_url_generator', TestRedirectGenerator::class);
Config::set('dystore.mollie.cancel_url_generator', TestRedirectGenerator::class);

/**
* Lunar configuration
Expand All @@ -150,7 +147,6 @@ public function getEnvironmentSetUp($app): void
Config::set('database.connections.sqlite', [
'driver' => 'sqlite',
'database' => ':memory:',
'prefix' => '',
]);

// Default payment driver
Expand Down
1 change: 0 additions & 1 deletion tests/Utils/CartBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ public static function build(array $cartParams = [])

Price::factory()->create([
'price' => 100,
'tier' => 1,
'currency_id' => $currency->id,
'priceable_type' => get_class($purchasable),
'priceable_id' => $purchasable->id,
Expand Down

0 comments on commit 553dc39

Please sign in to comment.