Skip to content

Commit

Permalink
Merge branch '1.x' into feature/discount-editing
Browse files Browse the repository at this point in the history
  • Loading branch information
alecritson authored Feb 15, 2024
2 parents 1bc657c + 4deab57 commit 16130ed
Show file tree
Hide file tree
Showing 135 changed files with 3,548 additions and 780 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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
composer.lock
/vendor
.phpunit.result.cache
.phpunit.cache/
/.idea
/.vscode
node_modules/
Expand Down
17 changes: 12 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,27 +16,29 @@
"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": {
"laravel/pint": "1.13.1",
"mockery/mockery": "^1.4.4",
"nunomaduro/larastan": "^2.0",
"larastan/larastan": "^2.9",
"orchestra/testbench": "^8.0",
"pestphp/pest": "^2.0",
"pestphp/pest-plugin-laravel": "^2.0",
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 docs/core/reference/pricing.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ them, first we'll create a standard price model.
$priceModel = \Lunar\Models\Price::create([
// ...
'price' => 1000, // Price is an int and should be in the lowest common denominator
'quantity_break' => 1,
'min_quantity' => 1,
]);

// Lunar\DataTypes\Price
Expand Down
18 changes: 9 additions & 9 deletions docs/core/reference/products.md
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,7 @@ front end.
| `price` | A integer value for the price | `null` | yes |
| `compare_price` | For display purposes, allows you to show a comparison price, e.g. RRP. | `null` | no |
| `currency_id` | The ID of the related currency | `null` | yes |
| `quantity_break` | The lower limit to get this price, 1 is the default for base pricing. | `1` | no |
| `min_quantity` | The minimum quantity required to get this price. | `1` | no |
| `customer_group_id` | The customer group this price relates to, leaving as `null` means any customer group | `null` | no |
| `priceable_type` | This is the class reference to the related model which owns the price | `null` | yes |
| `priceable_id` | This is the id of the related model which owns the price | `null` | yes |
Expand All @@ -450,7 +450,7 @@ $price = \Lunar\Models\Price::create([
'price' => 199,
'compare_price' => 299,
'currency_id' => 1,
'quantity_break' => 1,
'min_quantity' => 1,
'customer_group_id' => null,
'priceable_type' => 'Lunar\Models\ProductVariant',
'priceable_id' => 1,
Expand All @@ -476,7 +476,7 @@ relationship method.
'price' => 199,
'compare_price' => 299,
'currency_id' => 1,
'quantity_break' => 1,
'min_quantity' => 1,
'customer_group_id' => null,
'priceable_type' => 'Lunar\Models\ProductVariant',
'priceable_id' => 1,
Expand All @@ -493,24 +493,24 @@ You can specify which customer group the price applies to by setting the `custom
the price will apply to all customer groups. This is useful if you want to have different pricing for certain customer
groups and also different price quantity breaks per customer group.

### Quantity Break Pricing
### Price Break Pricing

Quantity Break pricing is a concept in which when you buy in bulk, the cost per item will change (usually go down). With Pricing
on Lunar, this is determined by the `quantity_break` column when creating prices. For example:
Price Break pricing is a concept in which when you buy in bulk, the cost per item will change (usually go down). With Pricing
on Lunar, this is determined by the `min_quantity` column when creating prices. For example:

```php
Price::create([
// ...
'price' => 199,
'compare_price' => 399,
'quantity_break' => 1,
'min_quantity' => 1,
]);

Price::create([
// ...
'price' => 150,
'compare_price' => 399,
'quantity_break' => 10,
'min_quantity' => 10,
]);
```

Expand Down Expand Up @@ -607,7 +607,7 @@ $pricing->base;
/**
* A collection of all the price quantity breaks available for the given criteria.
*/
$pricing->quantityBreaks;
$pricing->priceBreaks;

/**
* All customer group pricing available for the given criteria.
Expand Down
10 changes: 5 additions & 5 deletions docs/core/upgrading.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,22 +31,22 @@ for further information.
The `position` field has been removed from the `product_options` table and is now found on the `product_product_option`
pivot table. Any position data will be automatically adjusted when running migrations.

#### Tiers renamed to Quantity Breaks
#### Tiers renamed to Price Breaks

The `tier` column on pricing has been renamed to `quantity_break`, any references in code to `tiers` needs to be updated.
The `tier` column on pricing has been renamed to `min_quantity`, any references in code to `tiers` needs to be updated.

##### Price Model

```php
// Old
$priceModel->tier
// New
$priceModel->quantity_break
$priceModel->min_quantity

// Old
$priceModel->tiers
// New
$priceModel->quantityBreaks
$priceModel->priceBreaks
```

##### Lunar\Base\DataTransferObjects\PricingResponse
Expand All @@ -55,7 +55,7 @@ $priceModel->quantityBreaks
// Old
public Collection $tiered,
// New
public Collection $quantityBreaks,
public Collection $priceBreaks,
```

## 0.7
Expand Down
20 changes: 5 additions & 15 deletions packages/admin/resources/dist/lunar-panel.css
Original file line number Diff line number Diff line change
Expand Up @@ -1263,6 +1263,11 @@ select {
border-color: rgb(253 186 116 / var(--tw-border-opacity));
}

.border-primary-500 {
--tw-border-opacity: 1;
border-color: rgba(var(--primary-500), var(--tw-border-opacity));
}

.border-sky-300 {
--tw-border-opacity: 1;
border-color: rgb(125 211 252 / var(--tw-border-opacity));
Expand All @@ -1272,16 +1277,6 @@ select {
border-color: rgb(255 255 255 / 0.1);
}

.border-blue-500 {
--tw-border-opacity: 1;
border-color: rgb(59 130 246 / var(--tw-border-opacity));
}

.border-primary-500 {
--tw-border-opacity: 1;
border-color: rgba(var(--primary-500), var(--tw-border-opacity));
}

.bg-gray-200 {
--tw-bg-opacity: 1;
background-color: rgba(var(--gray-200), var(--tw-bg-opacity));
Expand Down Expand Up @@ -1340,11 +1335,6 @@ select {
background-color: rgb(255 255 255 / 0.7);
}

.bg-custom-600 {
--tw-bg-opacity: 1;
background-color: rgba(var(--c-600), var(--tw-bg-opacity));
}

.\!p-0 {
padding: 0px !important;
}
Expand Down
7 changes: 7 additions & 0 deletions packages/admin/resources/lang/en/attributegroup.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,11 @@
],
],

'action' => [
'delete' => [
'notification' => [
'error_protected' => 'This attribute group can not be deleted as there are attributes associated.',
],
],
],
];
7 changes: 7 additions & 0 deletions packages/admin/resources/lang/en/brand.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,11 @@
],
],

'action' => [
'delete' => [
'notification' => [
'error_protected' => 'This brand can not be deleted as there are products associated.',
],
],
],
];
7 changes: 7 additions & 0 deletions packages/admin/resources/lang/en/collectiongroup.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,11 @@
],
],

'action' => [
'delete' => [
'notification' => [
'error_protected' => 'This collection group can not be deleted as there are collections associated.',
],
],
],
];
7 changes: 7 additions & 0 deletions packages/admin/resources/lang/en/customergroup.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,11 @@
],
],

'action' => [
'delete' => [
'notification' => [
'error_protected' => 'This customer group can not be deleted as there are customers associated.',
],
],
],
];
1 change: 1 addition & 0 deletions packages/admin/resources/lang/en/fieldtypes.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
'richtext' => [
'label' => 'Rich Text',
],
'locales' => 'Locales',
],
],
'toggle' => [
Expand Down
11 changes: 11 additions & 0 deletions packages/admin/resources/lang/en/product.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,17 @@
'inventory' => [
'label' => 'Inventory',
],
'pricing' => [
'form' => [
'tax_class_id' => [
'label' => 'Tax Class',
],
'tax_ref' => [
'label' => 'Tax Reference',
'helper_text' => 'Optional, for integration with 3rd party systems.',
],
],
],
'shipping' => [
'label' => 'Shipping',
],
Expand Down
8 changes: 8 additions & 0 deletions packages/admin/resources/lang/en/producttype.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,12 @@
'no_attributes' => 'There are no attributes available.',
],

'action' => [
'delete' => [
'notification' => [
'error_protected' => 'This product type can not be deleted as there are products associated.',
],
],
],

];
3 changes: 3 additions & 0 deletions packages/admin/resources/lang/en/productvariant.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@
'label' => 'Quantity Increment',
'helper_text' => 'The product variant must be purchased in multiples of this quantity.',
],
'tax_class_id' => [
'label' => 'Tax Class',
],
'shippable' => [
'label' => 'Shippable',
],
Expand Down
Loading

0 comments on commit 16130ed

Please sign in to comment.