Skip to content

Commit

Permalink
Apply fixes from StyleCI (#397)
Browse files Browse the repository at this point in the history
Co-authored-by: Alec Ritson <alecritson@users.noreply.github.com>
  • Loading branch information
alecritson and alecritson committed Jun 9, 2021
1 parent f58e782 commit aac0b6d
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 21 deletions.
2 changes: 1 addition & 1 deletion src/Core/Auth/Actions/FetchImpersonationToken.php
Expand Up @@ -3,8 +3,8 @@
namespace GetCandy\Api\Core\Auth\Actions;

use GetCandy;
use Lorisleiva\Actions\Action;
use GetCandy\Api\Core\Traits\ReturnsJsonResponses;
use Lorisleiva\Actions\Action;

class FetchImpersonationToken extends Action
{
Expand Down
19 changes: 10 additions & 9 deletions src/Core/Discounts/Services/DiscountService.php
Expand Up @@ -2,17 +2,17 @@

namespace GetCandy\Api\Core\Discounts\Services;

use GetCandy;
use Carbon\Carbon;
use GetCandy\Api\Core\Discounts\RewardSet;
use GetCandy\Api\Core\Scaffold\BaseService;
use GetCandy;
use GetCandy\Api\Core\Attributes\Events\AttributableSavedEvent;
use GetCandy\Api\Core\Channels\Models\Channel;
use GetCandy\Api\Core\Products\Models\Product;
use GetCandy\Api\Core\Discounts\Models\Discount;
use GetCandy\Api\Core\Discounts\Models\DiscountCriteriaSet;
use GetCandy\Api\Core\Discounts\Discount as DiscountFactory;
use GetCandy\Api\Core\Discounts\Models\Discount;
use GetCandy\Api\Core\Discounts\Models\DiscountCriteriaItem;
use GetCandy\Api\Core\Attributes\Events\AttributableSavedEvent;
use GetCandy\Api\Core\Discounts\Models\DiscountCriteriaSet;
use GetCandy\Api\Core\Discounts\RewardSet;
use GetCandy\Api\Core\Products\Models\Product;
use GetCandy\Api\Core\Scaffold\BaseService;

class DiscountService extends BaseService
{
Expand Down Expand Up @@ -143,15 +143,15 @@ public function syncSets($discount, array $sets)
}
$itemIds[] = $model->id;
if (! empty($item['eligibles'])) {
switch($item['type']):
switch ($item['type']) {
case 'product':
$realIds = (new Product)->decodeIds($item['eligibles']);
break;
default:
$userModel = GetCandy::getUserModel();
$realIds = (new $userModel)->decodeIds($item['eligibles']);
break;
endswitch;
}
$model->saveEligibles($item['type'], $realIds);
}
}
Expand Down Expand Up @@ -198,6 +198,7 @@ public function syncRewards($discount, array $rewards)
}
}
}

return $discount;
}

Expand Down
11 changes: 5 additions & 6 deletions src/Core/Payments/Providers/PayPal.php
Expand Up @@ -2,16 +2,16 @@

namespace GetCandy\Api\Core\Payments\Providers;

use GetCandy\Api\Core\Payments\Models\Transaction;
use GetCandy\Api\Core\Payments\PaymentResponse;
use PayPal\Api\Amount;
use PayPal\Api\Refund;
use PayPal\Api\Capture;
use PayPal\Api\Payment;
use PayPal\Rest\ApiContext;
use PayPal\Api\Refund;
use PayPal\Api\RefundRequest;
use PayPal\Auth\OAuthTokenCredential;
use GetCandy\Api\Core\Payments\PaymentResponse;
use PayPal\Exception\PayPalConnectionException;
use GetCandy\Api\Core\Payments\Models\Transaction;
use PayPal\Rest\ApiContext;

class PayPal extends AbstractProvider
{
Expand Down Expand Up @@ -141,7 +141,7 @@ public function refund($token, $amount, $description)
{
try {
$paypalAmount = new Amount;
$paypalAmount->setCurrency("GBP")
$paypalAmount->setCurrency('GBP')
->setTotal($amount / 100);

$refundRequest = new RefundRequest;
Expand Down Expand Up @@ -169,7 +169,6 @@ public function refund($token, $amount, $description)
$transaction->save();

return $transaction;

} catch (PayPalConnectionException $e) {
$errors = json_decode($e->getData());
$response = new PaymentResponse(false, 'Refund Failed', json_decode($e->getData(), true));
Expand Down
4 changes: 2 additions & 2 deletions src/Core/Products/Actions/CreateProductFamily.php
Expand Up @@ -2,11 +2,11 @@

namespace GetCandy\Api\Core\Products\Actions;

use GetCandy\Api\Core\Scaffold\AbstractAction;
use GetCandy\Api\Core\Attributes\Actions\AttachModelToAttributes;
use GetCandy\Api\Core\Attributes\Models\Attribute;
use GetCandy\Api\Core\Products\Models\ProductFamily;
use GetCandy\Api\Core\Products\Resources\ProductFamilyResource;
use GetCandy\Api\Core\Attributes\Actions\AttachModelToAttributes;
use GetCandy\Api\Core\Scaffold\AbstractAction;

class CreateProductFamily extends AbstractAction
{
Expand Down
1 change: 0 additions & 1 deletion src/Core/Search/Providers/Elastic/Search.php
Expand Up @@ -4,7 +4,6 @@

use Elastica\Query;
use Elastica\Query\Wildcard;
use Elastica\Suggest;
use GetCandy\Api\Core\Search\ClientContract;
use GetCandy\Api\Core\Search\Providers\Elastic\Sorts\CategorySort;

Expand Down
2 changes: 1 addition & 1 deletion src/Core/Users/Actions/FetchUserAction.php
Expand Up @@ -2,8 +2,8 @@

namespace GetCandy\Api\Core\Users\Actions;

use GetCandy;
use App\User;
use GetCandy;
use Lorisleiva\Actions\Action;

class FetchUserAction extends Action
Expand Down
2 changes: 1 addition & 1 deletion src/Http/Resources/Discounts/DiscountItemResource.php
Expand Up @@ -2,8 +2,8 @@

namespace GetCandy\Api\Http\Resources\Discounts;

use GetCandy\Api\Http\Resources\AbstractResource;
use GetCandy\Api\Core\Users\Resources\UserCollection;
use GetCandy\Api\Http\Resources\AbstractResource;
use GetCandy\Api\Http\Resources\Products\ProductCollection;

class DiscountItemResource extends AbstractResource
Expand Down

0 comments on commit aac0b6d

Please sign in to comment.