From f7b4123dde774f75957b0df02d579a86e62f5b0d Mon Sep 17 00:00:00 2001 From: Daan Geurts Date: Wed, 16 Oct 2019 14:49:52 +0200 Subject: [PATCH] Style fixes --- README.md | 8 ++-- composer.json | 2 +- config/appstore-server-notifications.php | 1 + src/NotificationsServiceProvider.php | 1 + src/WebhooksController.php | 7 ++- src/model/AppleNotification.php | 2 +- src/model/NotificationPayload.php | 37 ++++++++------- src/model/Receipt.php | 59 ++++++++++++------------ src/model/RenewalInfo.php | 23 ++++----- tests/DummyJob.php | 9 ++-- tests/IntegrationTest.php | 14 +++--- 11 files changed, 81 insertions(+), 82 deletions(-) diff --git a/README.md b/README.md index e684dc4..8f2587c 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,10 @@ # Handle Appstore server-to-server notifications for auto-renewable subscriptions [![Latest Version on Packagist](https://img.shields.io/packagist/v/app-vise/laravel-appstore-notifications.svg?style=flat-square)](https://packagist.org/packages/app-vise/laravel-appstore-notifications) -[![Build Status](https://img.shields.io/travis/app-vise/laravel-appstore-notifications/master.svg?style=flat-square)](https://travis-ci.org/app-vise/laravel-appstore-notifications) -[![StyleCI](https://styleci.io/repos/105920179/shield?branch=master)](https://styleci.io/repos/105920179) -[![Quality Score](https://img.shields.io/scrutinizer/g/app-vise/laravel-appstore-notifications.svg?style=flat-square)](https://scrutinizer-ci.com/g/app-vise/laravel-appstore-notifications) -[![Total Downloads](https://img.shields.io/packagist/dt/app-vise/laravel-appstore-notifications.svg?style=flat-square)](https://packagist.org/packages/spatie/laravel-appstore-notifications) +[![Build Status](https://travis-ci.org/app-vise/laravel-appstore-notifications.svg?branch=master)](https://travis-ci.org/app-vise/laravel-appstore-notifications) +[![StyleCI](https://styleci.io/repos/215539443/shield?branch=master)](https://styleci.io/repos/215539443) +[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/app-vise/laravel-appstore-notifications/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/app-vise/laravel-appstore-notifications/?branch=master) +[![Total Downloads](https://img.shields.io/packagist/dt/app-vise/laravel-appstore-notifications.svg?style=flat-square)](https://packagist.org/packages/app-vise/laravel-appstore-notifications) ## Installation You can install this package via composer diff --git a/composer.json b/composer.json index 7cacab1..2937b7d 100644 --- a/composer.json +++ b/composer.json @@ -38,7 +38,7 @@ } }, "scripts": { - "test": "vendor/bin/phpunit --verbose" + "test": "vendor/bin/phpunit" }, "config": { "sort-packages": true diff --git a/config/appstore-server-notifications.php b/config/appstore-server-notifications.php index b0b4a6b..958226c 100644 --- a/config/appstore-server-notifications.php +++ b/config/appstore-server-notifications.php @@ -1,4 +1,5 @@ $notificationType, diff --git a/src/model/NotificationPayload.php b/src/model/NotificationPayload.php index a22ad6e..e5faebd 100644 --- a/src/model/NotificationPayload.php +++ b/src/model/NotificationPayload.php @@ -26,10 +26,9 @@ class NotificationPayload public function __construct() { - } - static function createFromRequest(Request $request) + public static function createFromRequest(Request $request) { $instance = new self(); $instance->environment = $request->input('environment'); @@ -56,7 +55,7 @@ class NotificationPayload } /** - * Get the value of environment + * Get the value of environment. */ public function getEnvironment() { @@ -64,7 +63,7 @@ class NotificationPayload } /** - * Get the value of notificationType + * Get the value of notificationType. */ public function getNotificationType() { @@ -72,7 +71,7 @@ class NotificationPayload } /** - * Get the value of pendingRenewalInfo + * Get the value of pendingRenewalInfo. */ public function getPendingRenewalInfo() { @@ -80,7 +79,7 @@ class NotificationPayload } /** - * Get the value of autoRenewStatusChangeDateMs + * Get the value of autoRenewStatusChangeDateMs. */ public function getAutoRenewStatusChangeDateMs() { @@ -88,7 +87,7 @@ class NotificationPayload } /** - * Get the value of autoRenewStatusChangeDatePst + * Get the value of autoRenewStatusChangeDatePst. */ public function getAutoRenewStatusChangeDatePst() { @@ -96,7 +95,7 @@ class NotificationPayload } /** - * Get the value of autoRenewStatusChangeDate + * Get the value of autoRenewStatusChangeDate. */ public function getAutoRenewStatusChangeDate() { @@ -104,7 +103,7 @@ class NotificationPayload } /** - * Get the value of autoRenewProductId + * Get the value of autoRenewProductId. */ public function getAutoRenewProductId() { @@ -112,7 +111,7 @@ class NotificationPayload } /** - * Get the value of autoRenewStatus + * Get the value of autoRenewStatus. */ public function getAutoRenewStatus() { @@ -120,7 +119,7 @@ class NotificationPayload } /** - * Get the value of latestExpiredReceiptInfo + * Get the value of latestExpiredReceiptInfo. */ public function getLatestExpiredReceiptInfo() { @@ -128,7 +127,7 @@ class NotificationPayload } /** - * Get the value of latestExpiredReceipt + * Get the value of latestExpiredReceipt. */ public function getLatestExpiredReceipt() { @@ -136,7 +135,7 @@ class NotificationPayload } /** - * Get the value of latestReceiptInfo + * Get the value of latestReceiptInfo. */ public function getLatestReceiptInfo() { @@ -144,7 +143,7 @@ class NotificationPayload } /** - * Get the value of latestReceipt + * Get the value of latestReceipt. */ public function getLatestReceipt() { @@ -152,7 +151,7 @@ class NotificationPayload } /** - * Get the value of webOrderLineItemId + * Get the value of webOrderLineItemId. */ public function getWebOrderLineItemId() { @@ -160,7 +159,7 @@ class NotificationPayload } /** - * Get the value of cancellationDateMs + * Get the value of cancellationDateMs. */ public function getCancellationDateMs() { @@ -168,7 +167,7 @@ class NotificationPayload } /** - * Get the value of cancellationDatePst + * Get the value of cancellationDatePst. */ public function getCancellationDatePst() { @@ -176,7 +175,7 @@ class NotificationPayload } /** - * Get the value of cancellationDate + * Get the value of cancellationDate. */ public function getCancellationDate() { @@ -184,7 +183,7 @@ class NotificationPayload } /** - * Get the value of password + * Get the value of password. */ public function getPassword() { diff --git a/src/model/Receipt.php b/src/model/Receipt.php index 51abb8f..715b299 100644 --- a/src/model/Receipt.php +++ b/src/model/Receipt.php @@ -40,7 +40,7 @@ class Receipt } - static function createFromArray(array $receiptInfo) + public static function createFromArray(array $receiptInfo) { $instance = new self(); $instance->originalTransactionId = $receiptInfo['original_transaction_id'] ?? null; @@ -71,12 +71,13 @@ class Receipt $instance->transactionId = $receiptInfo['transaction_id'] ?? null; $instance->bvrs = $receiptInfo['bvrs'] ?? null; $instance->bid = $receiptInfo['bid'] ?? null; + return $instance; } /** - * Get the value of bid + * Get the value of bid. */ public function getBid() { @@ -84,7 +85,7 @@ class Receipt } /** - * Get the value of bvrs + * Get the value of bvrs. */ public function getBvrs() { @@ -92,7 +93,7 @@ class Receipt } /** - * Get the value of transactionId + * Get the value of transactionId. */ public function getTransactionId() { @@ -100,7 +101,7 @@ class Receipt } /** - * Get the value of versionExternalIdentifier + * Get the value of versionExternalIdentifier. */ public function getVersionExternalIdentifier() { @@ -108,7 +109,7 @@ class Receipt } /** - * Get the value of appItemId + * Get the value of appItemId. */ public function getAppItemId() { @@ -116,7 +117,7 @@ class Receipt } /** - * Get the value of itemId + * Get the value of itemId. */ public function getItemId() { @@ -124,7 +125,7 @@ class Receipt } /** - * Get the value of isTrialPeriod + * Get the value of isTrialPeriod. */ public function getIsTrialPeriod() { @@ -132,7 +133,7 @@ class Receipt } /** - * Get the value of isInIntroOfferPeriod + * Get the value of isInIntroOfferPeriod. */ public function getIsInIntroOfferPeriod() { @@ -140,7 +141,7 @@ class Receipt } /** - * Get the value of uniqueVendorIdentifier + * Get the value of uniqueVendorIdentifier. */ public function getUniqueVendorIdentifier() { @@ -148,7 +149,7 @@ class Receipt } /** - * Get the value of uniqueIdentifier + * Get the value of uniqueIdentifier. */ public function getUniqueIdentifier() { @@ -156,7 +157,7 @@ class Receipt } /** - * Get the value of quantity + * Get the value of quantity. */ public function getQuantity() { @@ -164,7 +165,7 @@ class Receipt } /** - * Get the value of expiresDateFormattedPst + * Get the value of expiresDateFormattedPst. */ public function getExpiresDateFormattedPst() { @@ -172,7 +173,7 @@ class Receipt } /** - * Get the value of expiresDateFormatted + * Get the value of expiresDateFormatted. */ public function getExpiresDateFormatted() { @@ -180,7 +181,7 @@ class Receipt } /** - * Get the value of expiresDateMs + * Get the value of expiresDateMs. */ public function getExpiresDateMs() { @@ -188,7 +189,7 @@ class Receipt } /** - * Get the value of expiresDate + * Get the value of expiresDate. */ public function getExpiresDate() { @@ -196,7 +197,7 @@ class Receipt } /** - * Get the value of cancellationDatePst + * Get the value of cancellationDatePst. */ public function getCancellationDatePst() { @@ -204,7 +205,7 @@ class Receipt } /** - * Get the value of cancellationDateMs + * Get the value of cancellationDateMs. */ public function getCancellationDateMs() { @@ -212,7 +213,7 @@ class Receipt } /** - * Get the value of cancellationDate + * Get the value of cancellationDate. */ public function getCancellationDate() { @@ -220,7 +221,7 @@ class Receipt } /** - * Get the value of cancellationReason + * Get the value of cancellationReason. */ public function getCancellationReason() { @@ -228,7 +229,7 @@ class Receipt } /** - * Get the value of originalPurchaseDatePst + * Get the value of originalPurchaseDatePst. */ public function getOriginalPurchaseDatePst() { @@ -236,7 +237,7 @@ class Receipt } /** - * Get the value of originalPurchaseDateMs + * Get the value of originalPurchaseDateMs. */ public function getOriginalPurchaseDateMs() { @@ -244,7 +245,7 @@ class Receipt } /** - * Get the value of originalPurchaseDate + * Get the value of originalPurchaseDate. */ public function getOriginalPurchaseDate() { @@ -252,7 +253,7 @@ class Receipt } /** - * Get the value of purchaseDatePst + * Get the value of purchaseDatePst. */ public function getPurchaseDatePst() { @@ -260,7 +261,7 @@ class Receipt } /** - * Get the value of purchaseDate + * Get the value of purchaseDate. */ public function getPurchaseDate() { @@ -268,7 +269,7 @@ class Receipt } /** - * Get the value of purchaseDateMs + * Get the value of purchaseDateMs. */ public function getPurchaseDateMs() { @@ -276,7 +277,7 @@ class Receipt } /** - * Get the value of productId + * Get the value of productId. */ public function getProductId() { @@ -284,7 +285,7 @@ class Receipt } /** - * Get the value of webOrderLineItemId + * Get the value of webOrderLineItemId. */ public function getWebOrderLineItemId() { @@ -292,7 +293,7 @@ class Receipt } /** - * Get the value of originalTransactionId + * Get the value of originalTransactionId. */ public function getOriginalTransactionId() { diff --git a/src/model/RenewalInfo.php b/src/model/RenewalInfo.php index 619a090..2399f7b 100644 --- a/src/model/RenewalInfo.php +++ b/src/model/RenewalInfo.php @@ -21,7 +21,8 @@ class RenewalInfo { } - public static function createFromRequest(array $pendingRenewalInfo) { + public static function createFromRequest(array $pendingRenewalInfo) + { $instance = new self(); $instance->autoRenewProductId = $pendingRenewalInfo['auto_renew_product_id'] ?? null; $instance->autoRenewStatus = $pendingRenewalInfo['auto_renew_status'] ?? null; @@ -35,7 +36,7 @@ class RenewalInfo return $instance; } /** - * Get the value of autoRenewProductId + * Get the value of autoRenewProductId. */ public function getAutoRenewProductId() { @@ -43,7 +44,7 @@ class RenewalInfo } /** - * Get the value of autoRenewStatus + * Get the value of autoRenewStatus. */ public function getAutoRenewStatus() { @@ -51,7 +52,7 @@ class RenewalInfo } /** - * Get the value of expirationIntent + * Get the value of expirationIntent. */ public function getExpirationIntent() { @@ -59,7 +60,7 @@ class RenewalInfo } /** - * Get the value of originalTransactionId + * Get the value of originalTransactionId. */ public function getOriginalTransactionId() { @@ -67,7 +68,7 @@ class RenewalInfo } /** - * Get the value of isInBillingRetryPeriod + * Get the value of isInBillingRetryPeriod. */ public function getIsInBillingRetryPeriod() { @@ -75,7 +76,7 @@ class RenewalInfo } /** - * Get the value of productId + * Get the value of productId. */ public function getProductId() { @@ -83,7 +84,7 @@ class RenewalInfo } /** - * Get the value of priceConsentStatus + * Get the value of priceConsentStatus. */ public function getPriceConsentStatus() { @@ -91,7 +92,7 @@ class RenewalInfo } /** - * Get the value of gracePeriodExpiresDate + * Get the value of gracePeriodExpiresDate. */ public function getGracePeriodExpiresDate() { @@ -99,7 +100,7 @@ class RenewalInfo } /** - * Get the value of gracePeriodExpiresDateMs + * Get the value of gracePeriodExpiresDateMs. */ public function getGracePeriodExpiresDateMs() { @@ -107,7 +108,7 @@ class RenewalInfo } /** - * Get the value of gracePeriodExpiresDatePst + * Get the value of gracePeriodExpiresDatePst. */ public function getGracePeriodExpiresDatePst() { diff --git a/tests/DummyJob.php b/tests/DummyJob.php index 90eef0e..3fa065d 100644 --- a/tests/DummyJob.php +++ b/tests/DummyJob.php @@ -2,13 +2,12 @@ namespace Appvise\AppStoreNotifications\Tests; -use Appvise\AppStoreNotifications\Model\NotificationPayload; use Illuminate\Bus\Queueable; +use Illuminate\Queue\SerializesModels; +use Illuminate\Queue\InteractsWithQueue; use Illuminate\Contracts\Queue\ShouldQueue; use Illuminate\Foundation\Bus\Dispatchable; -use Illuminate\Queue\InteractsWithQueue; -use Illuminate\Queue\SerializesModels; - +use Appvise\AppStoreNotifications\Model\NotificationPayload; class DummyJob implements ShouldQueue { @@ -21,7 +20,7 @@ class DummyJob implements ShouldQueue $this->payload = $payload; } - function handle() + public function handle() { } } diff --git a/tests/IntegrationTest.php b/tests/IntegrationTest.php index 247672b..c2a5e1f 100644 --- a/tests/IntegrationTest.php +++ b/tests/IntegrationTest.php @@ -2,9 +2,9 @@ namespace Appvise\AppStoreNotifications\Tests; -use Appvise\AppStoreNotifications\Model\AppleNotification; use Illuminate\Support\Facades\Queue; use Illuminate\Support\Facades\Route; +use Appvise\AppStoreNotifications\Model\AppleNotification; class IntegrationTest extends TestCase { @@ -19,20 +19,18 @@ class IntegrationTest extends TestCase config( [ 'appstore-server-notifications.jobs' => [ - 'initial_buy' => DummyJob::class + 'initial_buy' => DummyJob::class, ], 'appstore-server-notifications.shared_secret' => 'VALID_APPLE_PASSWORD', ] ); - } /** @test */ public function it_can_handle_a_valid_request() { - $payload = include_once __DIR__ . '/__fixtures__/request.php'; - - $payload['password'] = "VALID_APPLE_PASSWORD"; + $payload = include_once __DIR__.'/__fixtures__/request.php'; + $payload['password'] = 'VALID_APPLE_PASSWORD'; $this ->postJson('/apple/server/notifications', $payload) @@ -51,8 +49,8 @@ class IntegrationTest extends TestCase /** @test */ public function a_request_with_an_invalid_password_wont_be_logged() { - $payload = include_once __DIR__ . '/__fixtures__/request.php'; - $payload['password'] = "NON_VALID_APPLE_PASSWORD"; + $payload = include_once __DIR__.'/__fixtures__/request.php'; + $payload['password'] = 'NON_VALID_APPLE_PASSWORD'; $this ->postJson('/apple/server/notifications', $payload)