Skip to content

Commit

Permalink
Merge branch '1.x' into feature/pricing-management
Browse files Browse the repository at this point in the history
  • Loading branch information
glennjacobs authored Feb 14, 2024
2 parents e552aa7 + e8c6eb8 commit 86193e3
Show file tree
Hide file tree
Showing 43 changed files with 2,337 additions and 39 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/split_packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
package: ["admin", "core", "opayo", "paypal", "scout-database-engine", "table-rate-shipping"]
package: ["admin", "core", "opayo", "paypal", "scout-database-engine", "table-rate-shipping", "stripe"]
steps:
- uses: actions/checkout@v2
- uses: shivammathur/setup-php@v2
Expand Down
46 changes: 46 additions & 0 deletions .github/workflows/stripe_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Lunar Stripe Tests
on:
pull_request:
defaults:
run:
working-directory: ./
jobs:
run:
runs-on: ubuntu-latest
strategy:
matrix:
php: [8.1, 8.2]
laravel: [10.*]
phpunit-versions: ['latest']
name: PHP:${{ matrix.php }} / Laravel:${{ matrix.laravel }}
steps:
- uses: actions/checkout@v2
- name: Setup PHP, with composer and extensions
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: mbstring, intl, amqp, dba
tools: composer:v2, phpunit:${{ matrix.php }}

- name: Get composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"

- name: Cache composer dependencies
uses: actions/cache@v2
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: dependencies-laravel-${{ matrix.laravel }}-php-${{ matrix.php }}-composer-${{ hashFiles('composer.json') }}
restore-keys: dependencies-laravel-${{ matrix.laravel }}-php-${{ matrix.php }}-composer-

- name: Install Composer dependencies
run: |
composer require "laravel/framework:${{ matrix.laravel }}" --no-interaction --no-update --dev
composer update --prefer-stable --no-interaction --no-suggest
- name: Execute tests (Unit and Feature tests) via PHPUnit
env:
APP_ENV: testing
DB_CONNECTION: testing
DB_DATABASE: ":memory:"
run: vendor/bin/pest --testsuite stripe
2 changes: 1 addition & 1 deletion .github/workflows/table_rate_shipping_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,4 @@ jobs:
APP_ENV: testing
DB_CONNECTION: testing
DB_DATABASE: ":memory:"
run: vendor/bin/pest --testsuite shipping --parallel
run: vendor/bin/pest --testsuite shipping
15 changes: 11 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,23 @@
"ext-bcmath": "*",
"ext-exif": "*",
"ext-intl": "*",
"filament/filament": "^3.1.23",
"filament/filament": "^3.2.25",
"filament/spatie-laravel-media-library-plugin": "^3.0-stable",
"guzzlehttp/guzzle": "^7.3",
"illuminate/http": "^10.0",
"kalnoy/nestedset": "^6.0",
"laravel/framework": "^10.0",
"laravel/scout": "^10.0",
"leandrocfe/filament-apex-charts": "^3.1.2",
"livewire/livewire": "^3.0",
"lukascivil/treewalker": "0.9.1",
"marvinosswald/filament-input-select-affix": "^0.1.0",
"php": "^8.1",
"spatie/laravel-activitylog": "^4.4",
"spatie/laravel-blink": "^1.6",
"spatie/laravel-medialibrary": "^10.0.0",
"spatie/laravel-permission": "^5.10",
"stripe/stripe-php": "^7.114",
"technikermathe/blade-lucide-icons": "^v2.24.0"
},
"require-dev": {
Expand Down Expand Up @@ -65,7 +67,8 @@
],
"Lunar\\ScoutDatabaseEngine\\": "packages/scout-database-engine/src",
"Lunar\\Shipping\\": "packages/table-rate-shipping/src",
"Lunar\\Shipping\\Database\\Factories\\": "packages/table-rate-shipping/database/factories"
"Lunar\\Shipping\\Database\\Factories\\": "packages/table-rate-shipping/database/factories",
"Lunar\\Stripe\\": "packages/stripe/src/"
}
},
"autoload-dev": {
Expand All @@ -76,19 +79,22 @@
"Lunar\\Tests\\Paypal\\": "tests/paypal",
"Lunar\\Tests\\ScoutDatabaseEngine\\": "tests/scout-database-engine",
"Lunar\\Tests\\Shipping\\": "tests/shipping",
"Lunar\\Shipping\\Tests\\": "packages/table-rate-shipping/tests"
"Lunar\\Shipping\\Tests\\": "packages/table-rate-shipping/tests",
"Lunar\\Tests\\Stripe\\": "tests/stripe"
}
},
"extra": {
"lunar": {
"name": [
"Table Rate Shipping",
"Opayo Payments",
"Paypal Payments"
"Paypal Payments",
"Stripe Payments"
]
},
"laravel": {
"providers": [
"Lunar\\Stripe\\StripePaymentsServiceProvider",
"Lunar\\Paypal\\PaypalServiceProvider",
"Lunar\\Admin\\LunarPanelProvider",
"Lunar\\Opayo\\OpayoServiceProvider",
Expand All @@ -104,6 +110,7 @@
"lunarphp/opayo": "self.version",
"lunarphp/paypal": "self.version",
"lunarphp/scout-database-engine": "self.version",
"lunarphp/stripe": "self.version",
"lunarphp/table-rate-shipping": "self.version"
},
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion packages/admin/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"minimum-stability": "dev",
"require": {
"lunarphp/core": "self.version",
"filament/filament": "^3.1.23",
"filament/filament": "^3.2.25",
"filament/spatie-laravel-media-library-plugin": "^3.0-stable",
"spatie/laravel-permission": "^5.10",
"barryvdh/laravel-dompdf": "^2.0",
Expand Down
32 changes: 16 additions & 16 deletions packages/admin/resources/lang/en/widgets.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@
'neutral' => 'No change compared to yesterday',
],
'stat_two' => [
'label' => 'Orders this week',
'increase' => ':percentage% increase from :count last week',
'decrease' => ':percentage% decrease from :count last week',
'neutral' => 'No change compared to last week',
'label' => 'Orders past 7 days',
'increase' => ':percentage% increase from :count last period',
'decrease' => ':percentage% decrease from :count last period',
'neutral' => 'No change compared to last period',
],
'stat_three' => [
'label' => 'Orders this month',
'increase' => ':percentage% increase from :count last month',
'decrease' => ':percentage% decrease from :count last month',
'neutral' => 'No change compared to last month',
'label' => 'Orders past 30 days',
'increase' => ':percentage% increase from :count last period',
'decrease' => ':percentage% decrease from :count last period',
'neutral' => 'No change compared to last period',
],
'stat_four' => [
'label' => 'Sales today',
Expand All @@ -29,16 +29,16 @@
'neutral' => 'No change compared to yesterday',
],
'stat_five' => [
'label' => 'Sales this week',
'increase' => ':percentage% increase from :total last week',
'decrease' => ':percentage% decrease from :total last week',
'neutral' => 'No change compared to last week',
'label' => 'Sales past 7 days',
'increase' => ':percentage% increase from :total last period',
'decrease' => ':percentage% decrease from :total last period',
'neutral' => 'No change compared to last period',
],
'stat_six' => [
'label' => 'Sales this month',
'increase' => ':percentage% increase from :total last month',
'decrease' => ':percentage% decrease from :total last month',
'neutral' => 'No change compared to last month',
'label' => 'Sales past 30 days',
'increase' => ':percentage% increase from :total last period',
'decrease' => ':percentage% decrease from :total last period',
'neutral' => 'No change compared to last period',
],
],
'order_totals_chart' => [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,24 +25,24 @@ protected function getStats(): array
'monthOverflow' => false,
]);

$currentMonth = $this->getOrderQuery(
from: $date->clone()->startOfMonth(),
$current30Days = $this->getOrderQuery(
from: $date->clone()->subDays(30),
to: $date->clone(),
);

$previousMonth = $this->getOrderQuery(
from: $date->clone()->subMonth()->startOfMonth(),
to: $date->clone(),
$previous30Days = $this->getOrderQuery(
from: $date->clone()->subDays(60),
to: $date->clone()->subDays(30),
);

$currentWeek = $this->getOrderQuery(
from: $date->clone()->startOfWeek(),
$current7Days = $this->getOrderQuery(
from: $date->clone()->subDays(7),
to: $date->clone(),
);

$previousWeek = $this->getOrderQuery(
from: $date->clone()->subWeek()->startOfWeek(),
to: $date->clone()->subWeek(),
$previous7Days = $this->getOrderQuery(
from: $date->clone()->subDays(14),
to: $date->clone()->subDays(7),
);

$today = $this->getOrderQuery(
Expand All @@ -57,11 +57,11 @@ protected function getStats(): array

return [
$this->getStatCount($today, $yesterday, 'stat_one'),
$this->getStatCount($currentWeek, $previousWeek, 'stat_two'),
$this->getStatCount($currentMonth, $previousMonth, 'stat_three'),
$this->getStatCount($current7Days, $previous7Days, 'stat_two'),
$this->getStatCount($current30Days, $previous30Days, 'stat_three'),
$this->getStatTotal($today, $yesterday, 'stat_four'),
$this->getStatTotal($currentWeek, $previousWeek, 'stat_five'),
$this->getStatTotal($currentMonth, $previousMonth, 'stat_six'),
$this->getStatTotal($current7Days, $previous7Days, 'stat_five'),
$this->getStatTotal($current30Days, $previous30Days, 'stat_six'),
];
}

Expand Down
2 changes: 0 additions & 2 deletions packages/admin/src/LunarPanelManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,6 @@ public function register(): self
$panel = $fn($panel);
}

$panel->id($this->panelId);

Filament::registerPanel($panel);

FilamentIcon::register([
Expand Down
6 changes: 6 additions & 0 deletions packages/stripe/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
composer.lock
/vendor
.phpunit.result.cache
/.idea
/.vscode
.DS_Store
Loading

0 comments on commit 86193e3

Please sign in to comment.