Skip to content

Commit

Permalink
Release - 2.0-beta15 (#471)
Browse files Browse the repository at this point in the history
  • Loading branch information
actions-user committed Aug 10, 2022
1 parent 7427e05 commit e186b4b
Show file tree
Hide file tree
Showing 115 changed files with 561 additions and 669 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,16 @@ All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

### 2.0-beta15 - 2022-08-10

### Fixed

- `doctrine/dbal` locked to `3.3.7` due to issue with Sqlite

### Changed

- You can now specify how media conversions will work via a class in the config.

### 2.0-beta14 - 2022-08-03

### Added
Expand Down
21 changes: 4 additions & 17 deletions config/media.php
Original file line number Diff line number Diff line change
@@ -1,22 +1,9 @@
<?php

use GetCandy\Base\StandardMediaConversions;

return [
'transformations' => [
'zoom' => [
'width' => 500,
'height' => 500,
],
'large' => [
'width' => 800,
'height' => 800,
],
'medium' => [
'width' => 500,
'height' => 500,
],
'small' => [
'width' => 300,
'height' => 300,
],
'conversions' => [
StandardMediaConversions::class,
],
];
16 changes: 8 additions & 8 deletions config/orders.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,20 +26,20 @@
'draft_status' => 'awaiting-payment',
'statuses' => [
'awaiting-payment' => [
'label' => 'Awaiting Payment',
'color' => '#848a8c',
'mailers' => [],
'label' => 'Awaiting Payment',
'color' => '#848a8c',
'mailers' => [],
'notifications' => [],
],
'payment-received' => [
'label' => 'Payment Received',
'color' => '#6a67ce',
'mailers' => [],
'label' => 'Payment Received',
'color' => '#6a67ce',
'mailers' => [],
'notifications' => [],
],
'dispatched' => [
'label' => 'Dispatched',
'mailers' => [],
'label' => 'Dispatched',
'mailers' => [],
'notifications' => [],
],
],
Expand Down
2 changes: 1 addition & 1 deletion config/payments.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

'types' => [
'cash-in-hand' => [
'driver' => 'offline',
'driver' => 'offline',
'authorized' => 'payment-offline',
],
],
Expand Down
4 changes: 2 additions & 2 deletions database/factories/OrderFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ public function definition(): array
'tax_breakdown' => [
[
'description' => 'VAT',
'total' => 200,
'percentage' => 20,
'total' => 200,
'percentage' => 20,
],
],
'tax_total' => $taxTotal,
Expand Down
4 changes: 2 additions & 2 deletions database/factories/OrderLineFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ public function definition(): array
'tax_breakdown' => [
[
'description' => 'VAT',
'total' => 200,
'percentage' => 20,
'total' => 200,
'percentage' => 20,
],
],
'tax_total' => $this->faker->numberBetween(1, 5000),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class CreateMediaTable extends Migration
{
public function up()
{
if (!Schema::hasTable('media')) {
if (! Schema::hasTable('media')) {
Schema::create('media', function (Blueprint $table) {
$table->bigIncrements('id');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public function up()
{
$tableName = config('activitylog.table_name');

if (!Schema::hasTable($tableName)) {
if (! Schema::hasTable($tableName)) {
Schema::create($tableName, function (Blueprint $table) {
$table->bigIncrements('id');
$table->string('log_name')->nullable();
Expand Down
2 changes: 1 addition & 1 deletion database/state/ConvertProductTypeAttributesToProducts.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public function run()
{
$prefix = config('getcandy.database.table_prefix');

if (!$this->canRun()) {
if (! $this->canRun()) {
return;
}

Expand Down
4 changes: 2 additions & 2 deletions database/state/EnsureDefaultTaxClassExists.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class EnsureDefaultTaxClassExists
{
public function run()
{
if (!$this->canRun() || !$this->shouldRun()) {
if (! $this->canRun() || ! $this->shouldRun()) {
return;
}

Expand All @@ -32,6 +32,6 @@ protected function canRun()

protected function shouldRun()
{
return !TaxClass::whereDefault(true)->count();
return ! TaxClass::whereDefault(true)->count();
}
}
2 changes: 1 addition & 1 deletion database/state/EnsureUserOrdersHaveACustomer.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class EnsureUserOrdersHaveACustomer
{
public function run()
{
if (!$this->canRun()) {
if (! $this->canRun()) {
return;
}

Expand Down
10 changes: 4 additions & 6 deletions src/Actions/Carts/CalculateLine.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,8 @@ class CalculateLine
/**
* Execute the action.
*
* @param \GetCandy\Models\CartLine $cartLine
* @param \Illuminate\Database\Eloquent\Collection $customerGroups
*
* @param \GetCandy\Models\CartLine $cartLine
* @param \Illuminate\Database\Eloquent\Collection $customerGroups
* @return \GetCandy\Models\CartLine
*/
public function execute(
Expand All @@ -30,7 +29,7 @@ public function execute(
$unitQuantity = $purchasable->getUnitQuantity();

// we check if any cart line modifiers have already specified a unit price in their calculating() method
if (!($price = $cartLine->unitPrice) instanceof Price) {
if (! ($price = $cartLine->unitPrice) instanceof Price) {
$priceResponse = Pricing::currency($cart->currency)
->qty($cartLine->quantity)
->currency($cart->currency)
Expand All @@ -48,8 +47,7 @@ public function execute(
$unitPrice = (int) round(
(($price->decimal / $purchasable->getUnitQuantity())
* $cart->currency->factor),
$cart->currency->decimal_places
);
$cart->currency->decimal_places);

$subTotal = $unitPrice * $cartLine->quantity;

Expand Down
21 changes: 10 additions & 11 deletions src/Actions/Carts/CreateOrder.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ class CreateOrder
/**
* Execute the action.
*
* @param \GetCandy\Models\Cart $cart
*
* @param \GetCandy\Models\Cart $cart
* @return void
*/
public function execute(
Expand Down Expand Up @@ -50,9 +49,9 @@ public function execute(
'tax_breakdown' => $cart->taxBreakdown->map(function ($tax) {
return [
'description' => $tax['description'],
'identifier' => $tax['identifier'],
'percentage' => $tax['amounts']->sum('percentage'),
'total' => $tax['total']->value,
'identifier' => $tax['identifier'],
'percentage' => $tax['amounts']->sum('percentage'),
'total' => $tax['total']->value,
];
})->values(),
'tax_total' => $cart->taxTotal->value,
Expand Down Expand Up @@ -81,9 +80,9 @@ public function execute(
'tax_breakdown' => $line->taxBreakdown->amounts->map(function ($amount) {
return [
'description' => $amount->description,
'identifier' => $amount->identifier,
'percentage' => $amount->percentage,
'total' => $amount->price->value,
'identifier' => $amount->identifier,
'percentage' => $amount->percentage,
'total' => $amount->price->value,
];
})->values(),
'tax_total' => $line->taxAmount->value,
Expand Down Expand Up @@ -121,9 +120,9 @@ public function execute(
'tax_breakdown' => $shippingAddress->taxBreakdown->amounts->map(function ($amount) {
return [
'description' => $amount->description,
'identifier' => $amount->identifier,
'percentage' => $amount->percentage,
'total' => $amount->price->value,
'identifier' => $amount->identifier,
'percentage' => $amount->percentage,
'total' => $amount->price->value,
];
})->values(),
'tax_total' => $shippingAddress->shippingTaxTotal->value,
Expand Down
5 changes: 2 additions & 3 deletions src/Actions/Carts/MergeCart.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,8 @@ class MergeCart
/**
* Execute the action.
*
* @param \GetCandy\Models\Cart $target
* @param \GetCandy\Models\Cart $source
*
* @param \GetCandy\Models\Cart $target
* @param \GetCandy\Models\Cart $source
* @return \GetCandy\Models\Cart
*/
public function execute(Cart $target, Cart $source)
Expand Down
9 changes: 4 additions & 5 deletions src/Actions/Carts/ValidateCartForOrder.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ class ValidateCartForOrder
/**
* Execute the action.
*
* @param \GetCandy\Models\Cart $cart
*
* @param \GetCandy\Models\Cart $cart
* @return void
*/
public function execute(
Expand All @@ -32,7 +31,7 @@ public function execute(
}

// Do we have a billing address?
if (!$cart->billingAddress) {
if (! $cart->billingAddress) {
throw new BillingAddressMissingException(
__('getcandy::exceptions.carts.billing_missing')
);
Expand All @@ -49,7 +48,7 @@ public function execute(

// Is this cart shippable and if so, does it have a shipping address.
if ($cart->getManager()->isShippable()) {
if (!$cart->shippingAddress) {
if (! $cart->shippingAddress) {
throw new ShippingAddressMissingException(
__('getcandy::exceptions.carts.shipping_missing')
);
Expand All @@ -65,7 +64,7 @@ public function execute(
}

// Do we have a shipping option applied?
if (!$cart->getManager()->getShippingOption()) {
if (! $cart->getManager()->getShippingOption()) {
throw new ShippingOptionMissingException();
}
}
Expand Down
3 changes: 1 addition & 2 deletions src/Actions/Collections/SortProducts.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ class SortProducts
/**
* Execute the action.
*
* @param \GetCandy\Models\Collection $collection
*
* @param \GetCandy\Models\Collection $collection
* @return void
*/
public function execute(Collection $collection)
Expand Down
7 changes: 3 additions & 4 deletions src/Actions/Collections/SortProductsByPrice.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,9 @@ class SortProductsByPrice
/**
* Execute the action.
*
* @param \Illuminate\Support\Collection $products
* @param \GetCandy\Models\Currency $currency
* @param string $direction
*
* @param \Illuminate\Support\Collection $products
* @param \GetCandy\Models\Currency $currency
* @param string $direction
* @return void
*/
public function execute(Collection $products, Currency $currency, $direction = 'asc')
Expand Down
5 changes: 2 additions & 3 deletions src/Actions/Collections/SortProductsBySku.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,8 @@ class SortProductsBySku
/**
* Execute the action.
*
* @param \Illuminate\Support\Collection $products
* @param string $direction
*
* @param \Illuminate\Support\Collection $products
* @param string $direction
* @return \Illuminate\Support\Collection
*/
public function execute(Collection $products, $direction = 'asc')
Expand Down
7 changes: 3 additions & 4 deletions src/Actions/Orders/GenerateOrderReference.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,16 @@ class GenerateOrderReference
/**
* Execute the action.
*
* @param \GetCandy\Models\CartLine $cartLine
* @param \Illuminate\Database\Eloquent\Collection $customerGroups
*
* @param \GetCandy\Models\CartLine $cartLine
* @param \Illuminate\Database\Eloquent\Collection $customerGroups
* @return \GetCandy\Models\CartLine
*/
public function execute(
Order $order
) {
$generator = config('getcandy.orders.reference_generator');

if (!$generator) {
if (! $generator) {
return null;
}

Expand Down
15 changes: 6 additions & 9 deletions src/Actions/Taxes/GetTaxZonePostcode.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ class GetTaxZonePostcode
/**
* Execute the action.
*
* @param string $postcode
*
* @param string $postcode
* @return null|\GetCandy\Models\TaxZonePostcode
*/
public function execute($postcode)
Expand All @@ -21,7 +20,7 @@ public function execute($postcode)
return $postcodeZone;
}

if (!$postcodeZone) {
if (! $postcodeZone) {
return null;
}

Expand All @@ -33,7 +32,7 @@ public function execute($postcode)
})->sort(fn ($current, $next) => $current['matches'] < $next['matches'])->first();

// Give up, use default...
if (!$match) {
if (! $match) {
return null;
}

Expand All @@ -43,8 +42,7 @@ public function execute($postcode)
/**
* Return the zone or zones which match this postcode.
*
* @param string $postcode
*
* @param string $postcode
* @return \GetCandy\Models\TaxZonePostcode|\Illuminate\Support\Collection
*/
protected function getZoneMatches($postcode)
Expand All @@ -61,9 +59,8 @@ protected function getZoneMatches($postcode)
/**
* Match wildcard postcodes and return number of matches.
*
* @param string $wildcard
* @param string $haystack
*
* @param string $wildcard
* @param string $haystack
* @return int
*/
private function matchWildcard($wildcard, $haystack)
Expand Down
Loading

0 comments on commit e186b4b

Please sign in to comment.