Skip to content

Commit

Permalink
Merge pull request #283 from imdhemy/improve-purchase-event
Browse files Browse the repository at this point in the history
[1.x] Improve purchase event
  • Loading branch information
imdhemy authored Feb 12, 2023
2 parents 6c3269f + 091f55d commit 154a3e2
Show file tree
Hide file tree
Showing 37 changed files with 140 additions and 18 deletions.
4 changes: 2 additions & 2 deletions src/Contracts/ServerNotificationContract.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace Imdhemy\Purchases\Contracts;

use GuzzleHttp\Client;
use GuzzleHttp\ClientInterface;

/**
* Interface ServerNotificationContract.
Expand All @@ -22,7 +22,7 @@ public function getType(): string;
/**
* Gets the subscription associated with the notification.
*/
public function getSubscription(?Client $client = null): SubscriptionContract;
public function getSubscription(?ClientInterface $client = null): SubscriptionContract;

/**
* Returns true if the notification is a test notification.
Expand Down
4 changes: 4 additions & 0 deletions src/Events/AppStore/Cancel.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@
namespace Imdhemy\Purchases\Events\AppStore;

use Imdhemy\Purchases\Events\PurchaseEvent;
use Imdhemy\Purchases\ServerNotifications\AppStoreServerNotification;

/**
* @method AppStoreServerNotification getServerNotification()
*/
class Cancel extends PurchaseEvent
{
}
5 changes: 5 additions & 0 deletions src/Events/AppStore/ConsumptionRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,12 @@
namespace Imdhemy\Purchases\Events\AppStore;

use Imdhemy\Purchases\Events\PurchaseEvent;
use Imdhemy\Purchases\ServerNotifications\AppStoreServerNotification;
use Imdhemy\Purchases\ServerNotifications\AppStoreV2ServerNotification;

/**
* @method AppStoreServerNotification|AppStoreV2ServerNotification getServerNotification()
*/
class ConsumptionRequest extends PurchaseEvent
{
}
3 changes: 3 additions & 0 deletions src/Events/AppStore/DidChangeRenewalPref.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
use Imdhemy\Purchases\ServerNotifications\AppStoreServerNotification;
use Imdhemy\Purchases\ServerNotifications\AppStoreV2ServerNotification;

/**
* @method AppStoreServerNotification|AppStoreV2ServerNotification getServerNotification()
*/
class DidChangeRenewalPref extends PurchaseEvent
{
public function getAutoRenewProductId(): ?string
Expand Down
3 changes: 3 additions & 0 deletions src/Events/AppStore/DidChangeRenewalStatus.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
use Imdhemy\Purchases\ServerNotifications\AppStoreV2ServerNotification;
use Imdhemy\Purchases\ValueObjects\Time;

/**
* @method AppStoreServerNotification|AppStoreV2ServerNotification getServerNotification()
*/
class DidChangeRenewalStatus extends PurchaseEvent
{
public function isAutoRenewal(): bool
Expand Down
5 changes: 5 additions & 0 deletions src/Events/AppStore/DidFailToRenew.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,12 @@
namespace Imdhemy\Purchases\Events\AppStore;

use Imdhemy\Purchases\Events\PurchaseEvent;
use Imdhemy\Purchases\ServerNotifications\AppStoreServerNotification;
use Imdhemy\Purchases\ServerNotifications\AppStoreV2ServerNotification;

/**
* @method AppStoreServerNotification|AppStoreV2ServerNotification getServerNotification()
*/
class DidFailToRenew extends PurchaseEvent
{
}
4 changes: 4 additions & 0 deletions src/Events/AppStore/DidRecover.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@
namespace Imdhemy\Purchases\Events\AppStore;

use Imdhemy\Purchases\Events\PurchaseEvent;
use Imdhemy\Purchases\ServerNotifications\AppStoreServerNotification;

/**
* @method AppStoreServerNotification getServerNotification()
*/
class DidRecover extends PurchaseEvent
{
}
5 changes: 5 additions & 0 deletions src/Events/AppStore/DidRenew.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,12 @@
namespace Imdhemy\Purchases\Events\AppStore;

use Imdhemy\Purchases\Events\PurchaseEvent;
use Imdhemy\Purchases\ServerNotifications\AppStoreServerNotification;
use Imdhemy\Purchases\ServerNotifications\AppStoreV2ServerNotification;

/**
* @method AppStoreServerNotification|AppStoreV2ServerNotification getServerNotification()
*/
class DidRenew extends PurchaseEvent
{
}
4 changes: 4 additions & 0 deletions src/Events/AppStore/Expired.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@
namespace Imdhemy\Purchases\Events\AppStore;

use Imdhemy\Purchases\Events\PurchaseEvent;
use Imdhemy\Purchases\ServerNotifications\AppStoreV2ServerNotification;

/**
* @method AppStoreV2ServerNotification getServerNotification()
*/
class Expired extends PurchaseEvent
{
}
4 changes: 4 additions & 0 deletions src/Events/AppStore/GracePeriodExpired.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@
namespace Imdhemy\Purchases\Events\AppStore;

use Imdhemy\Purchases\Events\PurchaseEvent;
use Imdhemy\Purchases\ServerNotifications\AppStoreV2ServerNotification;

/**
* @method AppStoreV2ServerNotification getServerNotification()
*/
class GracePeriodExpired extends PurchaseEvent
{
}
4 changes: 4 additions & 0 deletions src/Events/AppStore/InitialBuy.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@
namespace Imdhemy\Purchases\Events\AppStore;

use Imdhemy\Purchases\Events\PurchaseEvent;
use Imdhemy\Purchases\ServerNotifications\AppStoreServerNotification;

/**
* @method AppStoreServerNotification getServerNotification()
*/
class InitialBuy extends PurchaseEvent
{
}
4 changes: 4 additions & 0 deletions src/Events/AppStore/InteractiveRenewal.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@
namespace Imdhemy\Purchases\Events\AppStore;

use Imdhemy\Purchases\Events\PurchaseEvent;
use Imdhemy\Purchases\ServerNotifications\AppStoreServerNotification;

/**
* @method AppStoreServerNotification getServerNotification()
*/
class InteractiveRenewal extends PurchaseEvent
{
}
4 changes: 4 additions & 0 deletions src/Events/AppStore/OfferRedeemed.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@
namespace Imdhemy\Purchases\Events\AppStore;

use Imdhemy\Purchases\Events\PurchaseEvent;
use Imdhemy\Purchases\ServerNotifications\AppStoreV2ServerNotification;

/**
* @method AppStoreV2ServerNotification getServerNotification()
*/
class OfferRedeemed extends PurchaseEvent
{
}
4 changes: 4 additions & 0 deletions src/Events/AppStore/PriceIncrease.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@
namespace Imdhemy\Purchases\Events\AppStore;

use Imdhemy\Purchases\Events\PurchaseEvent;
use Imdhemy\Purchases\ServerNotifications\AppStoreV2ServerNotification;

/**
* @method AppStoreV2ServerNotification getServerNotification()
*/
class PriceIncrease extends PurchaseEvent
{
}
4 changes: 4 additions & 0 deletions src/Events/AppStore/PriceIncreaseConsent.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@
namespace Imdhemy\Purchases\Events\AppStore;

use Imdhemy\Purchases\Events\PurchaseEvent;
use Imdhemy\Purchases\ServerNotifications\AppStoreServerNotification;

/**
* @method AppStoreServerNotification getServerNotification()
*/
class PriceIncreaseConsent extends PurchaseEvent
{
}
5 changes: 5 additions & 0 deletions src/Events/AppStore/Refund.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,12 @@
namespace Imdhemy\Purchases\Events\AppStore;

use Imdhemy\Purchases\Events\PurchaseEvent;
use Imdhemy\Purchases\ServerNotifications\AppStoreServerNotification;
use Imdhemy\Purchases\ServerNotifications\AppStoreV2ServerNotification;

/**
* @method AppStoreServerNotification|AppStoreV2ServerNotification getServerNotification()
*/
class Refund extends PurchaseEvent
{
}
4 changes: 4 additions & 0 deletions src/Events/AppStore/RefundDeclined.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@
namespace Imdhemy\Purchases\Events\AppStore;

use Imdhemy\Purchases\Events\PurchaseEvent;
use Imdhemy\Purchases\ServerNotifications\AppStoreV2ServerNotification;

/**
* @method AppStoreV2ServerNotification getServerNotification()
*/
class RefundDeclined extends PurchaseEvent
{
}
5 changes: 4 additions & 1 deletion src/Events/AppStore/Renewal.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,13 @@
namespace Imdhemy\Purchases\Events\AppStore;

use Imdhemy\Purchases\Events\PurchaseEvent;
use Imdhemy\Purchases\ServerNotifications\AppStoreServerNotification;

/**
* @deprecated use \Imdhemy\Purchases\Events\AppStore\DidRecover instead
* @see \Imdhemy\Purchases\Events\AppStore\DidRecover
* @see DidRecover
*
* @method AppStoreServerNotification getServerNotification()
*/
class Renewal extends PurchaseEvent
{
Expand Down
5 changes: 5 additions & 0 deletions src/Events/AppStore/Revoke.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,12 @@
namespace Imdhemy\Purchases\Events\AppStore;

use Imdhemy\Purchases\Events\PurchaseEvent;
use Imdhemy\Purchases\ServerNotifications\AppStoreServerNotification;
use Imdhemy\Purchases\ServerNotifications\AppStoreV2ServerNotification;

/**
* @method AppStoreServerNotification|AppStoreV2ServerNotification getServerNotification()
*/
class Revoke extends PurchaseEvent
{
}
4 changes: 4 additions & 0 deletions src/Events/AppStore/Subscribed.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@
namespace Imdhemy\Purchases\Events\AppStore;

use Imdhemy\Purchases\Events\PurchaseEvent;
use Imdhemy\Purchases\ServerNotifications\AppStoreV2ServerNotification;

/**
* @method AppStoreV2ServerNotification getServerNotification()
*/
class Subscribed extends PurchaseEvent
{
}
4 changes: 4 additions & 0 deletions src/Events/GooglePlay/SubscriptionCanceled.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@
namespace Imdhemy\Purchases\Events\GooglePlay;

use Imdhemy\Purchases\Events\PurchaseEvent;
use Imdhemy\Purchases\ServerNotifications\GoogleServerNotification;

/**
* @method GoogleServerNotification getServerNotification()
*/
class SubscriptionCanceled extends PurchaseEvent
{
}
4 changes: 4 additions & 0 deletions src/Events/GooglePlay/SubscriptionDeferred.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@
namespace Imdhemy\Purchases\Events\GooglePlay;

use Imdhemy\Purchases\Events\PurchaseEvent;
use Imdhemy\Purchases\ServerNotifications\GoogleServerNotification;

/**
* @method GoogleServerNotification getServerNotification()
*/
class SubscriptionDeferred extends PurchaseEvent
{
}
4 changes: 4 additions & 0 deletions src/Events/GooglePlay/SubscriptionExpired.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@
namespace Imdhemy\Purchases\Events\GooglePlay;

use Imdhemy\Purchases\Events\PurchaseEvent;
use Imdhemy\Purchases\ServerNotifications\GoogleServerNotification;

/**
* @method GoogleServerNotification getServerNotification()
*/
class SubscriptionExpired extends PurchaseEvent
{
}
4 changes: 4 additions & 0 deletions src/Events/GooglePlay/SubscriptionInGracePeriod.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@
namespace Imdhemy\Purchases\Events\GooglePlay;

use Imdhemy\Purchases\Events\PurchaseEvent;
use Imdhemy\Purchases\ServerNotifications\GoogleServerNotification;

/**
* @method GoogleServerNotification getServerNotification()
*/
class SubscriptionInGracePeriod extends PurchaseEvent
{
}
4 changes: 4 additions & 0 deletions src/Events/GooglePlay/SubscriptionOnHold.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@
namespace Imdhemy\Purchases\Events\GooglePlay;

use Imdhemy\Purchases\Events\PurchaseEvent;
use Imdhemy\Purchases\ServerNotifications\GoogleServerNotification;

/**
* @method GoogleServerNotification getServerNotification()
*/
class SubscriptionOnHold extends PurchaseEvent
{
}
4 changes: 4 additions & 0 deletions src/Events/GooglePlay/SubscriptionPauseScheduleChanged.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@
namespace Imdhemy\Purchases\Events\GooglePlay;

use Imdhemy\Purchases\Events\PurchaseEvent;
use Imdhemy\Purchases\ServerNotifications\GoogleServerNotification;

/**
* @method GoogleServerNotification getServerNotification()
*/
class SubscriptionPauseScheduleChanged extends PurchaseEvent
{
}
4 changes: 4 additions & 0 deletions src/Events/GooglePlay/SubscriptionPaused.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@
namespace Imdhemy\Purchases\Events\GooglePlay;

use Imdhemy\Purchases\Events\PurchaseEvent;
use Imdhemy\Purchases\ServerNotifications\GoogleServerNotification;

/**
* @method GoogleServerNotification getServerNotification()
*/
class SubscriptionPaused extends PurchaseEvent
{
}
4 changes: 4 additions & 0 deletions src/Events/GooglePlay/SubscriptionPriceChangeConfirmed.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@
namespace Imdhemy\Purchases\Events\GooglePlay;

use Imdhemy\Purchases\Events\PurchaseEvent;
use Imdhemy\Purchases\ServerNotifications\GoogleServerNotification;

/**
* @method GoogleServerNotification getServerNotification()
*/
class SubscriptionPriceChangeConfirmed extends PurchaseEvent
{
}
3 changes: 2 additions & 1 deletion src/Events/GooglePlay/SubscriptionPurchased.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@
namespace Imdhemy\Purchases\Events\GooglePlay;

use Imdhemy\Purchases\Events\PurchaseEvent;
use Imdhemy\Purchases\ServerNotifications\GoogleServerNotification;

/**
* Class SubscriptionPurchased.
* @method GoogleServerNotification getServerNotification()
*/
class SubscriptionPurchased extends PurchaseEvent
{
Expand Down
4 changes: 4 additions & 0 deletions src/Events/GooglePlay/SubscriptionRecovered.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@
namespace Imdhemy\Purchases\Events\GooglePlay;

use Imdhemy\Purchases\Events\PurchaseEvent;
use Imdhemy\Purchases\ServerNotifications\GoogleServerNotification;

/**
* @method GoogleServerNotification getServerNotification()
*/
class SubscriptionRecovered extends PurchaseEvent
{
}
4 changes: 4 additions & 0 deletions src/Events/GooglePlay/SubscriptionRenewed.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@
namespace Imdhemy\Purchases\Events\GooglePlay;

use Imdhemy\Purchases\Events\PurchaseEvent;
use Imdhemy\Purchases\ServerNotifications\GoogleServerNotification;

/**
* @method GoogleServerNotification getServerNotification()
*/
class SubscriptionRenewed extends PurchaseEvent
{
}
4 changes: 4 additions & 0 deletions src/Events/GooglePlay/SubscriptionRestarted.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@
namespace Imdhemy\Purchases\Events\GooglePlay;

use Imdhemy\Purchases\Events\PurchaseEvent;
use Imdhemy\Purchases\ServerNotifications\GoogleServerNotification;

/**
* @method GoogleServerNotification getServerNotification()
*/
class SubscriptionRestarted extends PurchaseEvent
{
}
Loading

0 comments on commit 154a3e2

Please sign in to comment.