the browser-facing portion of osu!
fork

Configure Feed

Select the types of activity you want to include in your feed.

remove onPaymentCancel listener + other methods

bakaneko 0023da95 eac31b5e

+7 -81
+1 -9
app/Libraries/Payments/PaymentProcessor.php
··· 225 225 throw new Exception('Payment already cancelled.'); 226 226 } 227 227 228 - if ($payment !== null) { 229 - $payment->cancel(); 230 - $eventName = "store.payments.cancelled.{$payment->provider}"; 231 - } 232 - 228 + $payment?->cancel(); 233 229 $order->cancel(); 234 - 235 - if (isset($eventName)) { 236 - event($eventName, new PaymentEvent($order)); 237 - } 238 230 }); 239 231 } 240 232
-71
app/Listeners/Fulfillments/PaymentSubscribers.php
··· 1 - <?php 2 - 3 - // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the GNU Affero General Public License v3.0. 4 - // See the LICENCE file in the repository root for full licence text. 5 - 6 - namespace App\Listeners\Fulfillments; 7 - 8 - use App\Libraries\Fulfillments\FulfillmentFactory; 9 - use App\Mail\StorePaymentCompleted; 10 - use App\Models\Store\Order; 11 - use App\Traits\StoreNotifiable; 12 - use DB; 13 - use Exception; 14 - use Log; 15 - use Mail; 16 - 17 - /** 18 - * store.payments event dispatcher. 19 - * 20 - * Listens to the "store.payments" event stream and dispatches the appropriate 21 - * messages and commands. 22 - */ 23 - class PaymentSubscribers 24 - { 25 - use StoreNotifiable; 26 - 27 - public function onPaymentCancelled($eventName, $data) 28 - { 29 - $event = $data[0] ?? null; 30 - $fulfillers = FulfillmentFactory::createFulfillersFor($event->order); 31 - $count = count($fulfillers); 32 - $this->notifyOrder($event->order, "dispatching `{$count}` fulfillers", $eventName); 33 - 34 - DB::transaction(function () use ($fulfillers, $event, $eventName) { 35 - try { 36 - // This should probably be shoved off into a queue processor somewhere... 37 - foreach ($fulfillers as $fulfiller) { 38 - $fulfiller->revoke(); 39 - } 40 - } catch (Exception $exception) { 41 - $this->notifyError($exception, $event->order, $eventName); 42 - throw $exception; 43 - } 44 - }); 45 - } 46 - 47 - public function onPaymentError($eventName, $data) 48 - { 49 - // TODO: make notifyError less fruity and more like the other ones. 50 - $context = array_intersect_key($data, [ 51 - 'order_number' => '', 52 - 'notification_type' => '', 53 - 'transaction_id' => '', 54 - ]); 55 - $this->notifyError($data['error'], $data['order'], $eventName, $context); 56 - } 57 - 58 - public function onPaymentPending($eventName, $data) 59 - { 60 - $event = $data[0] ?? null; 61 - $this->notifyOrder($event->order, 'eCheck used; waiting to clear.', $eventName); 62 - } 63 - 64 - public function subscribe($events) 65 - { 66 - $events->listen( 67 - 'store.payments.cancelled.*', 68 - static::class.'@onPaymentCancelled' 69 - ); 70 - } 71 - }
+6
app/Models/Store/Payment.php
··· 41 41 $payment = $this->replicate(); 42 42 $payment->cancelled = true; 43 43 $payment->saveOrExplode(); 44 + 45 + \Datadog::increment( 46 + "{$GLOBALS['cfg']['datadog-helper']['prefix_web']}.store.payments.cancel", 47 + 1, 48 + ['provider' => $this->provider], 49 + ); 44 50 } 45 51 }
-1
app/Providers/EventServiceProvider.php
··· 19 19 ]; 20 20 21 21 protected $subscribe = [ 22 - Listeners\Fulfillments\PaymentSubscribers::class, 23 22 ]; 24 23 }