diff --git a/app/Libraries/Fulfillments/ApplySupporterTag.php b/app/Libraries/Fulfillments/ApplySupporterTag.php index f2bcb0d12d0..0cd40c70d76 100644 --- a/app/Libraries/Fulfillments/ApplySupporterTag.php +++ b/app/Libraries/Fulfillments/ApplySupporterTag.php @@ -5,6 +5,7 @@ namespace App\Libraries\Fulfillments; +use App\Models\Store\OrderItem; use App\Models\User; use App\Models\UserDonation; use Carbon\Carbon; @@ -13,7 +14,7 @@ /** * Applies a Supporter Tag donation from a store transaction. */ -class ApplySupporterTag extends OrderItemFulfillment +class ApplySupporterTag implements Fulfillable { public static function addDuration(Carbon $time, int $duration): Carbon { @@ -27,6 +28,10 @@ public static function addDuration(Carbon $time, int $duration): Carbon private User $donor; private User $target; + public function __construct(protected OrderItem $orderItem) + { + } + public function cancelledTransactionId() { return "{$this->getTransactionId()}-cancel"; @@ -35,7 +40,7 @@ public function cancelledTransactionId() /** * Performs the opration. * - * @throws Illuminate\Database\Eloquent\ModelNotFoundException If the donor or target could not be found. + * @throws \Illuminate\Database\Eloquent\ModelNotFoundException If the donor or target could not be found. */ public function run() { @@ -62,7 +67,7 @@ public function run() /** * Revokes the operation. * - * @throws Illuminate\Database\Eloquent\ModelNotFoundException If the donor or target could not be found. + * @throws \Illuminate\Database\Eloquent\ModelNotFoundException If the donor or target could not be found. */ public function revoke() { @@ -119,6 +124,11 @@ private function applySubscription() $this->target->osu_subscriber = true; } + private function getTransactionId() + { + return "{$this->orderItem->order->transaction_id}-{$this->orderItem->id}"; + } + private function revokeSubscription() { $previous = static::addDuration($this->target->osu_subscriptionexpiry, -$this->duration); @@ -128,7 +138,7 @@ private function revokeSubscription() private function setup() { - /** @var ExtraDataSupporterTag $extraData */ + /** @var \App\Models\Store\ExtraDataSupporterTag $extraData */ $extraData = $this->orderItem->extra_data; $this->amount = $this->orderItem->cost; diff --git a/app/Libraries/Fulfillments/OrderItemFulfillment.php b/app/Libraries/Fulfillments/OrderItemFulfillment.php deleted file mode 100644 index cb305f3de92..00000000000 --- a/app/Libraries/Fulfillments/OrderItemFulfillment.php +++ /dev/null @@ -1,21 +0,0 @@ -. Licensed under the GNU Affero General Public License v3.0. -// See the LICENCE file in the repository root for full licence text. - -namespace App\Libraries\Fulfillments; - -use App\Models\Store\OrderItem; - -// TODO: remove since this isn't really needed anymore -abstract class OrderItemFulfillment implements Fulfillable -{ - public function __construct(protected OrderItem $orderItem) - { - } - - public function getTransactionId() - { - return "{$this->orderItem->order->transaction_id}-{$this->orderItem->id}"; - } -}